Friday, July 31, 2009

Why wont Visual C++ make a .exe file?

I am using Visual C++ express edition to make Win32 Console Applications. When starting a new project, I select to create a blank Win32 Console App.


When I try and run/compile/debug my code it says that it can not find the relevant .exe file for my project so it can not run. Is there something I need to include/change for it to make the .exe?





e.g, my simple hello world app





#include %26lt;iostream%26gt;





int main()


{


std::cout %26lt;%26lt; "HelloWorld\n";


return 0;


}








refuses to create a .exe


any suggestions?

Why wont Visual C++ make a .exe file?
Hmm... I Don't know but this might help...


DWOF - Simple Execution.


Create simple EXE Files to do Simple Tasks (such as display a message or input box, or write a registry value or create a text file... you can do almost ANY simple Execution with this program... And it only cost $10.00... Or you can download the trail version.


http://www.dwof.net
Reply:why do you return 0 man





ur function and returns a constant


and by the way it will create exe file


u just save ur file and then compilate it and


voila


exe. :)


it wil be in obj


Debug folder if u didnt change anything
Reply:in the solution check to make sure you are compiling it as an app and not a library file...


--


to answer the guy below me:


"why do you return 0 man" - because this is c++ and usually a small quick program returns zero.. the main can return a whole lot of things, but to end the main's run it needs to return something.





"ur function and returns a constant" - don't program in c++ much, do you?
Reply:Use the wizard to make a simple hello world console app and don't change the main or stdafx lines. Run it as is.





If it is not running then there will be some errors in the code that you need to fix. Read the messages it puts out when it compiles.
Reply:for visual studio, you need to add





#include %26lt;stdafx.h%26gt;


No comments:

Post a Comment