Jump to content
  • Advertisement
Sign in to follow this  

link error?

This topic is 5056 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;


    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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!