Sign in to follow this  

link error?

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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;
    }

    atexit(SDL_Quit);


    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

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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