Compiling Trouble

Hi team,

Just purchased an easy to read guid for c++ programing.
Inside the book it gives an example greeting application through using cpp code to Exe. The book demonstrates compiling using an app called Mingw. I tried to set up the pp following the instructions given, such as add environment variables to the PATH Variable C:\mingw\bin. It then states to open up a command promptand enter c++, toward whereby the result should state nothing has been specified for compilation. Firstly, i haven't the slightest clue as to what Promt i should use. I tried opening up the GUI for Mingw but it won't open.

So i decided to go for Microsoft vc 10 express. Using this, i create a Cpp greeting file with the basic 'hello' code. Can't compile and debug a single cpp file, so i then understood that i must use the variable 'project' for the cpp file to be recognised and compiled.

Firstly should i use build or debug? What does each do? I am trying tocreate a CPP with a exe file. I pres build and after debug the program says it scannot find hello.exe? Please help.

Am i missing something.....please how to i create an exe from the cpp file??
It then states to open up a command promptand enter c++


it is reffering to the windows command promt.
if you are using windows 7: click windows logo and type "cmd" <enter>.
this will open a command promt for you.

when using vc++ express you don't need to configure anything. just create a new application and choose empty project. add a new cpp file and enter your code and press the "run" button.
Hi, Thanks for your reply.

Where can i find the 'Run' Button? Thanks
the green "play" button.(triangle)
The only green triangle i can find is 'Start Debuging.' and it is not available, (Greyscale- it won't t let me click it? I am editing a source CPP file not a project? Must i use a project for it to work?
yes, use a project.otherwise it is just a fancy text editor;)

and the 'Start Debuging' button is right one.
Thanks, like i said in my first post, i hit the build buton first to build the coded. Then, either beofre or after this, i hit the green (G0) debug button. Then i nget a pop- up error saying 'Hello.exe' cannot be found. Basiacally i don;t know how to solve this?

eg
Hello.cpp - Debug - Error - can't locate file hello.exe????


Please help
are you sure the code is compiled without errors?
Last edited on
Yes The code is fine, here it is....

#include <iostream>

using namespace std;

int main()

{

cout << "Hello!" << endl;

return 0 ;

}


Supposedly the built Exe of the CPP code, should have been created and filed.; can't find the EXE's anywhere at all.

Last edited on
it is in the debug folder inside your project folder.

And btw, this application will terminate immediately. place a getchar(); right before the return to let the application stay open...
Thank you so much, i worked it out, and created my first program using the code from book.
Yipee!!

Once again, thank you.

Sorry guy's, it's happening again. When i hit debig ready to compile, the error message pops up and says that it cannot find file Hello.exe.

I checked the debug folder, and it's not there either, the code is fine.

Am i doing something wrong, i completely forgot how i prevailed (Previous Reply)

Thank you.
it sounds weird. when the executable is not present it normally means the compile has not succeeded. and when you hit "start debugging" it should build automaticly.
Or at least ask you for it.
That's what i mean, it's not compiling the Cpp to the exe. AS soon as i hit debug run, it does something in the bottom part of the interface, to signal something has compiled, as soon as it happens ath eerror ge pops up.

When it worked before, it completed the process and made the exe!!!
maybe you shouls make an new project and copy the source code you have in the new project
I have tried this many times, still remains an error?
I have tried this many times, still remains an error?


The code is fine. Whatever the problem is, it's not a C++ problem. It's a problem with the setup of your IDE. You'll have better luck at a forum of your IDE, rather than a C++ forum.
Last edited on
That's what i mean, it's not compiling the Cpp to the exe. AS soon as i hit debug run, it does something in the bottom part of the interface, to signal something has compiled, as soon as it happens ath eerror ge pops up.


Maybe you should pay more attention to the something going on in the bottom part of the interface.
Topic archived. No new replies allowed.