PoHate

I have this book to learn C++ and i've tried this small code on two different compilers (Visual C++ 2005 express edition) and Bloodshed (a freeware compiler)

#include <iostream>

main (void)

{

std::cout << "Hello people" << std::endl;

return 0;

}

It does not work on Visual C++ but it works on the other compiler, I get an error on Visual C++ stating "Unable to start program 'c:\users\carl\documents\visual studio 2005\ iuyig\debug\y\iuyig.exe'. The system cannot find the path specified."

Now First i just made a new file (just a .cpp file) and it wouldn't allow me to debug with ctrl f5 or just f5, until i added a project, which i then did by adding a win32 console application.

Now why does this error occur and won't open the msdos window with my little text box

Thanks



Re: Visual C++ Express Edition Need some Help please new to C++

Jonathan Caves - MSFT

It looks like you may have changed the default location for the the executable - I say this for a couple of reasons 1) the supurious y\ in the path - normally I would expect to see debug\iuyig.exe not dedug\y\iuyig.exe and 2) it looks from the text above that there is an extra space before iuyig\debug\...

I would advise creating a new Win32 Console application and try again.






Re: Visual C++ Express Edition Need some Help please new to C++

PoHate

I've created many Win32 console applications as well tried this on my desktop downstairs with a different compiler that doesn't work on vista.




Re: Visual C++ Express Edition Need some Help please new to C++

claude.legault

I have only begun using VC++ Express myself, so take this with a grain of salt...

A) The program should not compile.. it's missing int from the main call:

Code Snippet

int main (void)


Without the int, the program may well compile on other compiler (i.e.: Linux g++) but possibly not on VC++.


B) The path seems wrong even if an executable was created... my path on Windows XP is:

C:\Documents and Settings\"%User%"\My Documents\Visual Studio 2005\Projects\"%ThisIsTheProject%"\debug


Where %User is my name and "%ThisIsTheProject%"is the actual project. In your case, carl and iuyig.

I would suggest you recompile the code using int and if it still fails use explorer to verify if the path exist (as described in the error line) and if an executable was created.

Good luck,
Claude.





Re: Visual C++ Express Edition Need some Help please new to C++

Pibeac

I had the same problem, when i tried to run the compiled program in debug, i got a "Unable to start program abc.exe" and when i doubled-click on the abc.exe i got, Not a valid win32 application... so i replaced

Code Block

int _tmain( ... )


by

Code Block

int main(...)


and now it works ! does anybody know why