Warnings when compiling with command prompt (MSVC++)

This is a discussion on Warnings when compiling with command prompt (MSVC++) within the C++ Programming forums, part of the General Programming Boards category; Take a look. (I placed a code]tag around the output to make it slightly more readable.) Code: D:\...\...\...\Debug>cl ../pcname.cpp /link ...

  1. #1
    0x01
    Join Date
    Sep 2001
    Posts
    88

    Warnings when compiling with command prompt (MSVC++)

    Take a look. (I placed a code]tag around the output to make it slightly more readable.)
    Code:
    
    D:\...\...\...\Debug>cl ../pcname.cpp /link user32.lib
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
    Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
    
    pcname.cpp
    C:\Program Files\Microsoft Visual Studio\VC98\include\istream(547) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
    C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(137) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(133) : whi
    le compiling class-template member function 'class std::basic_ostream<char,struc
    t std::char_traits<char> > &__thiscall std::basic_ostream<char,struct std::char_
    traits<char> >::operator <<(long)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(149) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(145) : whi
    le compiling class-template member function 'class std::basic_ostream<char,struc
    t std::char_traits<char> > &__thiscall std::basic_ostream<char,struct std::char_
    traits<char> >::operator <<(unsigned long)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(234) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(229) : whi
    le compiling class-template member function 'class std::basic_ostream<char,struc
    t std::char_traits<char> > &__thiscall std::basic_ostream<char,struct std::char_
    traits<char> >::put(char)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(234) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(229) : whi
    le compiling class-template member function 'class std::basic_ostream<unsigned s
    hort,struct std::char_traits<unsigned short> > &__thiscall std::basic_ostream<un
    signed short,struct std::char_traits<unsigned short> >::put(unsigned short)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\istream(218) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\istream(211) : whi
    le compiling class-template member function 'int __thiscall std::basic_istream<c
    har,struct std::char_traits<char> >::get(void)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\istream(46) : warning C453
    0: C++ exception handler used, but unwind semantics are not enabled. Specify -GX
    
            C:\Program Files\Microsoft Visual Studio\VC98\include\istream(41) : whil
    e compiling class-template member function 'bool __thiscall std::basic_istream<c
    har,struct std::char_traits<char> >::ipfx(bool)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\istream(46) : warning C453
    0: C++ exception handler used, but unwind semantics are not enabled. Specify -GX
    
            C:\Program Files\Microsoft Visual Studio\VC98\include\istream(41) : whil
    e compiling class-template member function 'bool __thiscall std::basic_istream<u
    nsigned short,struct std::char_traits<unsigned short> >::ipfx(bool)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\xstring(525) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            C:\Program Files\Microsoft Visual Studio\VC98\include\xstring(521) : whi
    le compiling class-template member function 'void __thiscall std::basic_string<c
    har,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned i
    nt)'
    C:\Program Files\Microsoft Visual Studio\VC98\include\ostream(296) : warning C45
    30: C++ exception handler used, but unwind semantics are not enabled. Specify -G
    X
            ../pcname.cpp(15) : see reference to function template instantiation 'cl
    ass std::basic_ostream<char,struct std::char_traits<char> > &__cdecl std::operat
    or <<(class std::basic_ostream<char,struct std::char_traits<char> > &,const char
     *)' being compiled
    Microsoft (R) Incremental Linker Version 6.00.8168
    Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
    
    /out:pcname.exe
    user32.lib
    pcname.obj
    Is doesn't do this when I compile with the GUI (MSVC++ 6.0 | WINDOWS XP).

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,088
    warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify -GX
    What happens when you specify -GX in your build settings? Try going to Project->Settings, moving to the C/C++ tab, changing the category from General to C++ Language, and checking the box next to "Enable exception handling".

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    I have some notes on this...

    Hmmm...

    I have some notes at home about how to set-up the compiler to work from the command line. I'll look them up this evening (California time).

    I got the info from "Programming Windows" by Charles Petzold... The stuff I have is for Windows 98 and MSVC++ 5.0, but your warnings look familiar.

    In general, I had to run a batch file or two (once very boot-up) before executing the compiler. I also remember editing one of the VC++ files (.INI ???), and changing the DOS "environment" size. [EDIT]: It wasnt' an ini file it was VCVARS.BAT

    I've found it MUCH easier to use the GUI / IDE... once I figured out how to use it!
    Last edited by DougDbug; 08-05-2003 at 10:15 PM.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Files attached

    C++.BAT is the main batch file which calls MSC.BAT.
    C++.BAT has a call to Jen's file editor, which you probably need to delete. You might have to change some other path names.

    MSC.BAT is the secret file that initializes the compiler "environment". You might have to add -GX to the SET CFLAGS or the SET CFLAGSMT lines (?)

    ReadMe.TXT notes a couple of other changes I made to "get it to work". I assume that the newer versions of MSCV++ don't have reference the CD-ROM. (It expected to find the CD in the drive when running.)
    Attached Files Attached Files
    Last edited by DougDbug; 08-05-2003 at 10:17 PM.

  5. #5
    0x01
    Join Date
    Sep 2001
    Posts
    88
    The compiler works fine... its just I get those warning everytime I use the the commmand prompt compiler... MSVC++ 6.0 already sets everything up for you when you intstall it.

    Try going to Project->Settings, moving to the C/C++ tab, changing the category from General to C++ Language, and checking the box next to "Enable exception handling".
    It was already done.

    DougDbug, I'll check out it out.

  6. #6
    0x01
    Join Date
    Sep 2001
    Posts
    88
    I typed: cl /GX ../pcname.cpp -o pcname.exe /link user32.lib

    And it got rid of all those warnings... I just don't understand.. why?

    What is the /GX? Why/How did it get rid of the warnings?
    Last edited by knave; 08-06-2003 at 09:55 AM.

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I don't know what GX does... I don't know if my older compiler even has that option. Either you are disabling the C++ exception handler, or you are enabling the unwind semantics... whatever that means (?)

    I don't think I ever found any documentation for this stuff. I did have to "hack" Petzold's version of MSC.BAT a little to get it to work perfectly.

    But, you should be able to set-up all the command line options in advance by typing them in, or by running MSC.BAT. (After you boot and before you compile.)

    After running MSC.BAT, I don't have to use any of the command line options or paramaters. I just type "cl MySource.cpp"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Warnings when using vector of vector
    By Boksha in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2008, 02:54 PM
  2. Replies: 9
    Last Post: 03-14-2008, 10:55 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 04:15 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21