Hey all,
I don't know what the deal is, but I'm using MSVC++.NET 2003 and I keep getting this error:
LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Debug/test5.exe : fatal error LNK1120: 1 unresolved externals
I'm just making a basic SDL/OpenGL window, here's my code for that:
#define WIN32_LEAN_AND_MEAN
#define EXTRA_LEAN
#include <windows.h>
#include <SDL/SDL.h>
#include <gl/gl.h>
#include <gl/glu.h>
SDL_Event event;
void Render();
int main(int argc, char *argv[]);
int main(int argc, char *argv[]){
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(1024,768, 0, SDL_OPENGL | SDL_HWSURFACE );
SDL_WM_SetCaption("SDL Window", "SDL Window");
glViewport(0, 0, 1024, 768);
glMatrixMode(GL_PROJECTION); // set projection matrix current matrix
glLoadIdentity(); // reset projection matrix
// calculate aspect ratio of window
gluPerspective(54.0f,(GLfloat)1024/(GLfloat)768,1.0f,1000.0f);
glMatrixMode(GL_MODELVIEW); // set modelview matrix
glLoadIdentity();
int done;
for(done = 0; !done;){
SDL_PollEvent(&event);
Render();
//Keyboard input.
if(event.key.keysym.sym == SDLK_ESCAPE)
done = 1;
if(event.type == SDL_KEYDOWN)
{
}
if(event.type == SDL_KEYUP)
{
}
if(event.type == SDL_QUIT){done = 1;}
}
SDL_Quit();
return 0;
}
void Render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glLoadIdentity();
gluLookAt(0,0,40,0,0,0,0,1,0);
glPushMatrix();
glFlush();
SDL_GL_SwapBuffers();
}
I tried it both with a Win32 Project and Console Project, the only difference is the Win32 project gives me a WinMain error instead of main. I'm not including those cursed precompiled headers, and I'm linking all the necessary libraries: opengl32.lib glu32.lib sdl.lib.
So, what's my problem?
Thanks a bunch,
Nathan
--