Menu

command-line option for dev 4992

codor kim
2008-05-19
2012-09-26
  • codor kim

    codor kim - 2008-05-19

    Hello, I have a question. I'm reading Jeff Cogswell's book "C++ for Dummies" and on p. 191 it describes how you can take a look at the codes after the preprocessor has replaced all the #includes but before the compilation. It says:

    "In the MinGW and Cygwin compiler... you compile your program by using the gcc command... The preprocessor command is cpp. If your paths are set up right and you want to try it out, just type... (e.g.) 'cpp main.cpp'. And prepare yourself for a lot of lines..."

    But how exactly do you do that? Where do you type the command 'cpp main.cpp'? I the idiot tried typing it on the cmd and got the response that it's an unrecognizable command. So where is the command-line console of dev-c++?

    Thanks. I use dev 4992 on Vista.

     
    • codor kim

      codor kim - 2008-05-26

      Excuse me Clifford. I followed your instruction but, still, no. All the main.cpps and projects I store in dev-cpp file itself, not in its bin. so I typed c:\dev-cpp\cpp main23.cpp to get to my main23.cpp in project23, but the cmd just replied that the command is not recognizable. Same thing when I typed c:\dev-cpp\bin\cpp main23.cpp. I then set up the path just as you have instructed, adding c:\cpp-dev\bin the first time and then just c:\cpp-dev\ the second time in the variable value box, and then typed the same thing in cmd, but, still, command unrecognized.

      Unless I failed to understand. What do you mean by "change the working directory to the location of the file you want to pre-process"?

       
    • cpns

      cpns - 2008-05-19

      Like the man said: "If your paths are set up right [...]". They are not, so you can't.

      I have to wonder why this would be in a book aimed at beginners, and suspect that the phrase "And prepare yourself for a lot of lines..." kind of indicates that this is not really something that you want or need to do, and it is just for interest or perhaps he is showing off.

      You typed the command in exactly the right place. It was the path set-up that you ignored.

      Start->Control Panel->System->Advanced->Environment variables, in System Variables, select the variable "Path", and click Edit. At the end of the "Variable Value", add ";c:\dev-cpp\bin", then OK your way out of there. Open a console window, change the working directory to the location of the file you want to pre-process and try again.

      Alternatively just type:

      c:\dev-cpp\bin\cpp main.cpp

      (of course you need to be in the directory containing main.cpp or prefix the file name with its path too.)

      There should be book "How to operate a computer for dummy programmers" since many people seem to try to program one without much idea how one works in the first place!

      With respect to opening a console in teh right folder, I recommend the Microsoft "Command Here" power toy, which allows you to open a command console from the Explorer context menu in the selected folder. http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

      Clifford

       
    • codor kim

      codor kim - 2008-05-23

      Thanks Clif for the so so enlightening explanation. Yes, I do want to buy "How to operate a computer for dummy programmers". You crack me up.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.