Thread: Compiling from DOS Prompt using Visual Studio Express 2005

  1. #1
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62

    Compiling from DOS Prompt using Visual Studio Express 2005

    Hey


    I have been trying to compile my programs using
    Visual Studio Express 2005 from the Command Line
    in windows xp.
    One tutorial says:

    cl -GX prog1.cpp

    but the compiler says something like "-GX will not be used
    in a future release of the compiler....", and it will NOT compile.

    Of course I can use the GUI to compile, and then it all works fine,
    but I think I should be able to do it by hand, so to speak....in a
    DOS prompt. ;-)


    Any suggestions
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    /GS would be want you want. Not -GS. However, this switch instructs the compiler to do buffer security checks for you. Which is unecessary since it is ON by default. /GS- would disable it.

    cl /EHs prog1.cpp is probably the most minimalist choice. It compiles prog1.cpp with exception handling.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Didn't correctly read your original post. You were trying to use GX, not GS. GX enables exception handling. However it is deprecated. Use /EH options instead, like the exaple on my previous post.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62
    hmm...

    The compiler still complains: no include path set

    If I run vcvars32.bat, then it works, but I would like the change
    to be PERMANENT
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Put the contents of vcvars32.bat in \autoexec.bat.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62
    hi dwks

    Nope, unless I ALWAYS run autoexec.bat, before I compile....

    seems very complicated.....hmmmm...
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Ah, yes. The environment variables.

    Open vsvars32.bat with a text editor. It's located on your visual studio folder/common7/tools. You see those set commands? Those are the environment variables you need to add to your system environment variables.

    Right-click my computer->Properties->Advanced->Environment Variables. Add each and one of those to the system variables part.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Nope, unless I ALWAYS run autoexec.bat, before I compile....
    AUTOEXEC.BAT is always executed when the computer turns on. You'll just have to reboot, or at least re-launch your DOS prompts.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It might be run when you run a particular kind of backward compatibility DOS emulator, I didn't think it was touched at all in a normal XP boot up.

    Besides, the environment can be set on a per user basis in XP, so a global autoexec.bat doesn't make sense.

    Create a cmd file with
    Code:
    call vcvars32.bat
    start cmd
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Replies: 3
    Last Post: 10-16-2008, 02:09 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  5. Visual C++ 2005 Express Edition
    By BestGameMovie in forum C++ Programming
    Replies: 6
    Last Post: 05-15-2005, 01:49 PM