Code: Select all
Main.obj : error LNK2019: unresolved external symbol _atexit referenced in function _SDL_main
Main.obj : error LNK2019: unresolved external symbol __imp__printf referenced in function _SDL_main
Main.obj : error LNK2001: unresolved external symbol __fltused
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
Code: Select all
int main(int argc, char *argv[])
as for the others I have no clue. Lots of things have said that its due to not including the libraries right... but I'm pretty sure they are all there I'm linking the following libraries to my project
Code: Select all
sdl.lib sdlmain.lib opengl32.lib glu32.lib
Code: Select all
#include <stdio.h>
#include <sdl.h>
#include <sdl_opengl.h>
#include <gl/gl.h>
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_EVERYTHING | SDL_OPENGL) < 0)
{
printf("Unable to init SDL %s\n", SDL_GetError());
return 1;
}
atexit(SDL_Quit);
SDL_WM_SetCaption("Sp4c3 1nv4d3rz", NULL);
//Set icon at the topleft to be this
SDL_Surface* image = SDL_LoadBMP("icon.bmp");
int colorkey = SDL_MapRGB(image->format, 255,0,255);
SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
SDL_WM_SetIcon(image, NULL);
//OGL attributes :P
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface* screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_OPENGL);
if (!screen)
{
printf("Unable to set %ix%i video: %s\n", SCREEN_WIDTH, SCREEN_HEIGHT, SDL_GetError());
return 1;
}
//OGL viewport and stuff like buffer clear color
glViewport(0, 0, screen->w, screen->h);
glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0); //This will need to be changed...
glClearColor(0.0, 0.0, 0.0, 0.0);
//quit?
bool done = false;
//main game loop
while (!done)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
{
done = true;
break;
}
case SDL_KEYDOWN:
{
if (event.key.keysym.sym == SDLK_ESCAPE)
{
done = true;
}
break;
}
}
}
//Draw GL stuff!
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_TRIANGLES);
glVertex2f(400.0, 160.0);
glVertex2f(320.0, 440.0);
glVertex2f(480.0, 440.0);
glEnd();
SDL_GL_SwapBuffers();
}
return 0;
}