Sign in to follow this  
turyturbo

Error while compile (VS C++ 2008)

Recommended Posts

<I posted this in General Programming and not sure if this is best place for me to post, too.> Hi: I was trying to set up OpenGL libraries in my VS C++ 2008 then do the lesson 01 (Nehe). I followed the instructions for setup. Then I tried to compile one file. Since the glauxReplacement.cpp is incomplete, I used bmp.cpp/bmp.h from one of those threads and put bmp.h in header folder, bmp.cpp in source folder. Replaced the <h\glaux.h> with "bmp.h" Then I got this error: MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup I tried some modifications what some threads suggested. Project->Properties->System->SubSystem = Windows(...)options Then I got this error: 1>c:\users\<name>\documents\visual studio 2008\projects\practices\practices\bmp.cpp(56) : error C2664: 'LoadImageW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I did this: Project->Properties->General->Character Set = Use Multi-Byte Character Set Then I got this error AGAIN: 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 1>C:\Users\<name>\Documents\Visual Studio 2008\Projects\Practices\Debug\Practices.exe : fatal error LNK1120: 1 unresolved externals The error kept loop. What is the solution? Thank you, TT

Share this post


Link to post
Share on other sites
Thanks for reply.

I added #define WinMain

then I got this error:

1>c:\program files\microsoft sdks\windows\v6.1\include\winbase.h(2561) : error C2059: syntax error : '('

In WinBase.h:

It shows:

WinMain (
__in HINSTANCE hInstance,
__in_opt HINSTANCE hPrevInstance,
__in LPSTR lpCmdLine,
__in int nShowCmd
);

It looks fine to me. What should I do to fix this?

Thank you,
TT

Share this post


Link to post
Share on other sites
That's not what jpetrie meant by "define WinMain".

You have to code the definition of the WinMain() function (instead of the main() function if you were writing a console program). Here's an example.

Perhaps you should read up on and practice a bit of Win32 programming before you jump into OpenGL, or you could use a framework that handles the windows stuff for you (SFML, etc).

Share this post


Link to post
Share on other sites
Krez and jpetrie:

Thank you for your replies. Yes, you are correct. Somehow, I followed the lesson 01 off Nehe website.

In the middle, it said to run the compiler. That's where I got errors at that point. Then, later on, in the bottom of Lesson01. It already included the definition of WinMain.

Now, it compiles just fine. My apologizes. :)

Thanks again,
TT

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this