problem
im on nehe lesson 2 and everytime i try to run it, it says there are 2 errors. on error is LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main, and the other is just 1 unresolved external symbol. there used to be 20, but i put the libs in. what should i do?
do you have a main function and what's the other unresolved symbol? and, btw, please don't cross post
http://www.roboguy.net(WIP) - lisperati - SICP - Haskell - Python - OCaml - Lambda the Ultimate - Good Math, Bad Math - Wiki (not Wikipedia) - Pure - Term-Rewriting Functional Language
1.) You aren't running your project file (.dsw or .vcproj, if you're using MS Visual Studio), but a single .cpp file. You should be running the whole project file.
2.) You have gl headers included before windows header. You should have it like:
#include <windows.h> // must be the first one
#include <GL/gl.h>
...
Well, maybe it's something else.
2.) You have gl headers included before windows header. You should have it like:
#include <windows.h> // must be the first one
#include <GL/gl.h>
...
Well, maybe it's something else.
Quote: Original post by Wingman
2.) You have gl headers included before windows header.
I believe you mean: You mus include the gl headers after the windows header, also I'd recommend a setup more like this, so it's a bit easier if you decide to port it later:
#ifdef WIN32#include <windows.h>#endif#include <GL/gl.h>//...
http://www.roboguy.net(WIP) - lisperati - SICP - Haskell - Python - OCaml - Lambda the Ultimate - Good Math, Bad Math - Wiki (not Wikipedia) - Pure - Term-Rewriting Functional Language
The likely explanation for this is that you are compiling as a console application when you actually have a Windows application. Console applications have the entry point int main() or int main(int argc, char** argv) whereas Windows applications have the entry point int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow). If you try compiling a Windows application as a console application the compiler will look for the main function and fail to find it, reporting an unresolved external symbol: main (The underscore you see is just something added by the compiler to avoid naming conflicts). Change your compiler options to compile as a windows application.
Enigma
Enigma
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement