User forums > Using Code::Blocks

error LNK2001: unresolved external symbol _WinMainCRTStartup

(1/2) > >>

mutabor:
Hello,

I´m a newbie in c++ AND Code::Blocks, so maybe someone can help me to solve the following problem:

I´m using Microsoft Platform SDK and Microsoft Visual C++ Toolkit 2003.

I try to build a little WIN32GuiApplication (-Projekt), just for testing.
Here is my code:

********************************************

#include <windows.h>

int WINAPI main(HINSTANCE hInstance, 
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow) 
{

    MessageBox(0, "Nachricht", "Titel", MB_OK);

    return 0;
}

******************************************

When I try to compile the source, I get the following error message:

error LNK2001: unresolved external symbol _WinMainCRTStartup

I searched Google and I think it has something to do with the entry-point of the application (?).
So I think I have to change some Linker-Options or whatever ?!

Could someone please tell me, how to solve this problem and getting the source compiled?

Thank you, mutabor

stahta01:

--- Quote from: mutabor on January 19, 2008, 05:28:14 pm ---error LNK2001: unresolved external symbol _WinMainCRTStartup

--- End quote ---

This is an linker type error implies the idea that you are missing an needed library.

I suggest it might be the Library MSVCRT. I have no idea if that is the Library name or not.

What is your OS? XP, Vista, etc.

What version of the Platform SDK? Some of the new SDKs may have issues with 2003 Toolkit; I can not remember if that is so or not.

Tim S

stahta01:
Try compiling in release and post your build log with full compiler logging on.

[full compiler logging]
Settings -> Compiler and Debugger -> Tab "Other" -> Compiler logging = "Full command line".

Tim S

Note: I installed an PSDK called PSDK-x86.exe dated 2005/2006; no idea where to download it from.

Google suggested it was this link I got it from
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en


--- Code: ----------------- Build: Release in Test ---------------

cl.exe /nologo /W3  /Og /Ox /DNDEBUG    /I"C:\Program Files\Microsoft Platform SDK\include" /I"C:\Program Files\Microsoft Visual C++ Toolkit 2003\include"  /IF:\SourceCode\Projects\sokoban\ksokoban-svn\Test /c main.cpp /Foobj\Release\main.obj
main.cpp
link.exe /nologo /subsystem:windows /LIBPATH:"C:\Program Files\Microsoft Platform SDK\lib" /LIBPATH:"C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib"  /out:bin\Release\Test.exe gdi32.lib user32.lib kernel32.lib  obj\Release\main.obj   
Output size is 22.50 KB

--- End code ---

mutabor:
Hi Tim,

thank you for your replies!

I am using WindowsXP, Microsoft Platform SDK and Microsoft Visual C++ Toolkit 2003.

I searched for the msvcrt.lib in the Toolkit/Lib folder and only found it in an AMD64- and IA64-folder (!), so I think its the wrong (64-bit) version ?!

Do I have to get an other version of the msvcrt.lib or do I have to download the whole SDK again?
I admit, that I am a little bit confused :-(

Here is, what I get from Code:Blocks Build Log:

-------------- Build: default in Windows ---------------
link.exe /nologo /subsystem:windows /LIBPATH:"C:\Programme\Microsoft Visual C++ Toolkit 2003\lib"  /out:Windows.exe gdi32.lib user32.lib kernel32.lib  .objs\main.obj   
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
Windows.exe : fatal error LNK1120: 1 unresolved externals
Process terminated with status 1 (0 minutes, 1 seconds)
2 errors, 0 warnings
 
Any help would be great!

Thanx, mutabor


MortenMacFly:

--- Quote from: mutabor on January 25, 2008, 05:58:52 pm ----------------- Build: default in Windows ---------------
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup

--- End quote ---
...mind using Google before asking? ;-)
http://www.google.de/search?q=unresolved+external+symbol+_WinMainCRTStartup
Note that compiler errors are an issue of the *compiler*. We can't know all compiler in detail. So when such things happen - use Google and/or contact the compiler devs.
With regards, Morten.

Navigation

[0] Message Index

[#] Next page

Go to full version