First time I've seen this link error. Trying (VC6) to build hello.c:
#include <stdio.h>
int main (int argc, char **argv) {
printf("hello, world\n");
}
gives this error:
1>------ Build started: Project: hello-world, Configuration: Debug
Win32 ------
1>Compiling manifest to resources...
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function ___tmainCRTStartup
1>Debug\hello-world.exe : fatal error LNK1120: 1 unresolved externals
I must have changed something somewhere in VC6 defaults to give this
crazy-seeming error, but what?
Can someone please give me a clue as to what's going on?
Thanks!
-- Pete
-- Pete
The "something badly wrong" was that I had set up the project to be
merely a win32 app rather than a win32 CONSOLE app. I should have
taken the hint that WinMain was unresolved.
-- Pete
|1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
|_WinMain@16 referenced in function ___tmainCRTStartup
|1>Debug\hello-world.exe : fatal error LNK1120: 1 unresolved externals
|
|I must have changed something somewhere in VC6 defaults to give this
|crazy-seeming error, but what?
|
|Can someone please give me a clue as to what's going on?
I don't think it's a default. (Not particularly remembering VC6,) if you specify
"Windows Application" when you create a project it'll look for WinMain, if you
specify "Console Application", main (tmain, wmain). It's changeable. Check the
project's Properties ... Linker ... System ... Subsystem.
--
- Vince
I'm not quite familiar with C development, but does that mean a VC Win32
console project has complete control over the EXE entry point code?
> I'm not quite familiar with C development, but does that mean a VC Win32
> console project has complete control over the EXE entry point code?
Yes, I believe you can consider it so, practically speaking. There is
first some run-time setup; and then main() is called as a function by
the runtime, upon which the main program is in control.
-- Pete