View Full Version : i am having trouble in VC++ 6
10-20-2005, 03:16 PM
Hi i am trying to get some tutorials from nehe and ultimategameprogramming to work but when i try to build my exe file i get this error:
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/openGLEx.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I am running VC++ 6.0. I have included the three header files opengl32, glu32.lib and glaux.lib.
I am new to opengl and am very sorry for be a pain in the arse but if u could help it would be very much appreciated.
This topic should best fits in the Windows forum. Anyway, there are 2 options for you:
1. you use OpenGL32.lib then you'll need a windows api (so with WinMain, WinProc and such) and link with the windows library. Beware: no main function is allowed in this situation, but you'll have a full Windows window.
2. don't use OpenGL32.lib but OpenGL.lib, glut.lib (not the *32). Then you'll be able to use the standard main function. However you'll have a DOS window.
Also, avoid using glaux, and prefer glut instead.
10-21-2005, 06:28 AM
The real problem is that you started your project as a Console project, but your code assumes a WinApp project.
Remember the following and you should be fine.
Console projects = main entry point.
WinApp projects = WinMain entry point.
If your source code uses WinMain, start a WinApp project. If your source code uses main, start a Console project.
the real problem... :cool: well surely. :)
10-21-2005, 11:35 AM
Heheh, well... there is nothing about either opengl32.lib or opengl.lib that make them unusable in either type of project. Libraries don't, and shouldn't, care anything about the entry point of a project.
It's actually pretty common for an app linked to opengl32.lib to have an entry point of main. Most apps that use glut, SDL, or any number of other windowing systems typically do that.
Originally posted by Deiussum:
Heheh, well... there is nothing about either opengl32.lib or opengl.lib that make them unusable in either type of project. Libraries don't, and shouldn't, care anything about the entry point of a project.That's what I meant. But don't forget the Win32 API that 'hides' the main function behind WinMain or so: you simply cannot declare the main function of a C/C++ program in a full W32 app.
And you simply cannot use OpenGL32.lib in a DOS app that's, as far as I can remember, and 16 bits app. You can use OpenGL.lib in a WIN32 API, that's right, but you will only get a DOS window, not a windows window.
Anyway, that's not a point for making arise divergences :)
10-21-2005, 11:49 AM
Actually, you can create a normal Win32 app from a main function, it just isn't too commonly seen. If you look at the source for glut or just about any other cross-platform windowing API for instance, you will find hidden somewhere in there is a call to all the methods like CreateWindow[Ex], complete with a WindowProc somewhere.
And you are right that you cannot use opengl32.lib from a DOS compiled app, but a Win32 console app with an entry point of main is NOT the same as a DOS binary... And since we are talking about VC++ 6 here, not TC++, it is obviously compiling Win32 binaries, not DOS binaries.
Thank you for the information, I didn't know that we can use main on a full W32 app. I'll might check that when (well if) I'll install Windows again on my machine(s).
i think you should use for your project type win32console application
10-25-2005, 10:51 PM
In VC2003.net, you can simply go to the project's property page, in the "Link" tab, reset the "SubSystem" to "Not Set" or "Console", you don't have to re-create another project. For VC6, do the similary setting.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.