Author | Message | Time |
---|---|---|
MysT_DooM | Now im not making like a real high tech program, i was just foolin around makin the "Hello World" program thing and this error comes up: LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/delte this.exe : fatal error LNK1120: 1 unresolved externals ~~~~~~~~~~~ This is my code for the Hello program: ///Hello #include <iostream.h> int main() { cout <<"Hello Computer User\n\a"; return 0; } ~~~~~~~~~~~~~~~~~~ U see theres nuttin wrong wit my code... WATS WRONG | May 30, 2004, 10:57 PM |
K | you have the project setup as a windows application, not a console application. your code is (almost) fine, but this is better: [code] // the new c++ stl headers don't have .h at the end // and everything is inside the std namespace to prevent // naming conflicts #include <iostream> // but we can just use the namespace since this is // a small program with no conflicts. using namespace std; int main() { // endl is a special object that not only prints a \r\n character // but flushes the stream so that the text you wrote is written // right away, which doesn't always happen. cout << "Hello Computer User" << endl; return 0; } [/code] but don't sweat that too much. here's how to fix your problem: (assuming visual c++) go to project properties, click on LINKER, then on SYSTEM and change the SUBSYSTEM property from "Windows (/SUBSYSTEM:WINDOWS)" to "Console (/SUBSYSTEM:CONSOLE)" You'll need to do this for both DEBUG and RELEASE configurations if you plan on changing the configuration. Then your program should compile fine!. | May 30, 2004, 11:13 PM |
Eibro | You can also use the VC++ specific directive #pragma comment(linker, "/SUBSYSTEM:CONSOLE" ) | June 1, 2004, 4:43 AM |