When I compile my windows application, I receive the error message "Unresolved external '_main' referenced from <path>c0x32.obj"
What this error really means is that the linker cannot find the entry-point function for your program. 'c0x32.obj', which is the startup code for a console application, is asking the linker to find a function named 'main', the standard C/C++ entrypoint. The linker has searched the project's object files and libraries, but cannot find the 'main' function.
This kind of error is usually caused by some mix-up between the intended project type and the actual project type. For instance, if you chose File, New, Console Wizard, checking 'Console Application', but proceeded to write a windows-style application, with a WinMain entrypoint, this is exactly the error you would receive. To remedy the problem, you would create a new project, of the correct type, and add your source files to the new project.
If compiling from the command line, the "target" options are analogous to the project type, and must likewise, be consistent with the application you're writing. The following list shows the BCC32.EXE options and their intended targets:
-W | Target is Windows application ("WinMain" entrypoint) | |
-TC | Target is console application ("main" entrypoint) | |
-WD | Target is a DLL ("DllMain" entrypoint) |
Last Modified: 14-MAR-02