The main problem was…

Just having started at a new company recently, up to this point I had only contributed to an existing C++ project; but yesterday I needed to create a new one myself.  After getting a basic makefile put together and putting some necessaries in the precompiled header, I bumped into a couple of linker errors:

link.exe @C:\DOCUME~1\DANIEL~1.MEY\LOCALS~1\Temp\mk1178003 /out:"DebugU\MyUtilityUD.exe"
LINK : DebugU\MyUtilityUD.exe not found or not built by the last incremental link; performing full link
   Creating library DebugU\MyUtilityUD.lib and object DebugU\MyUtilityUD.exp
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl ir::recorderserver::ace_os_main_i(class ACE_Main_Base &,int,char * * const)" (__imp_?ace_os_main_i@recorderserver@ir@@YAHAAVACE_Main_Base@@HQAPAD@Z) referenced in function "int __cdecl ir::recorderserver::wmain(int,wchar_t * * const)" (?wmain@recorderserver@ir@@YAHHQAPA_W@Z)
msvcrtd.lib(wcrtexe.obj) : error LNK2019: unresolved external symbol _wmain referenced in function ___tmainCRTStartup
DebugU\MediaStatusGenUD.exe : fatal error LNK1120: 2 unresolved externals

I had a main() function.  Did ACE expect _wmain() ?  Or some weird ace_os_main_i()?

No, I had just placed my main() function inside a couple of namespaces rather than at the global level.  Doh!  Of course, main() needs to be declared in the global namespace.

Noting here so next time I don’t spend an hour of futile fiddling with the makefile for this.  ;)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s