Sign in to follow this  

link error?

Recommended Posts

Why do I get a link error with this code:
#include <SDL/SDL.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
using namespace std;

int main() {
    if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
    cout << "Error" << endl;
    return 1;


    SDL_Surface *screen;
    screen = SDL_SetVideoMode(800,600,0,SDL_HWSURFACE|SDL_DOUBLEBUF);

    return 0;

[link error] undifined refenrence to 'SDL_main' [build error] [SDLProject1.exe] Error 1 I linked the following files and normaly it works fine (with other codes) libmingw32.a libSDLmain.a libSDL.a so It's something in my code I guess but I don't know what :(

Share this post

Link to post
Share on other sites
ow.. do you always need to add those arguments to the main function??

I thought you could just add them when you're going to use them in your program just like in the normal c++ :/

thanks for your help.

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