CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: SDL issues

  1. #1
    Join Date
    Jul 2013

    Question SDL issues

    I am trying to use SDL to make a movie easter egg. The movie code is

    #include <iostream>
    #include <string>
    #include "SDL.h"
    using namespace std;
    int i;
    int main(int argc, char* args[]) {
         cout << "Welcome to the movie easter egg.";
         i = 1;
         if (i == 1) {
         SDL_Surface* frame1 = NULL;
        SDL_Surface* screen = NULL;
        if((SDL_Init(SDL_INIT_EVERYTHING)==-1)) { 
        cout << "Error initiating movie."; }
        screen = SDL_SetVideoMode( 640, 480, 64, SDL_HWSURFACE );
        frame1 = SDL_LoadBMP( "C:\\Users\\User\\Desktop\\Frames\\Frame1.bmp" );
         SDL_BlitSurface( frame1, NULL, screen, NULL );
        SDL_Flip( screen );
        SDL_FreeSurface( frame1 );
        return 0;
    I am running Dev-C++ on windows 7 and I followed Lazy-foo's tutorial. I get a linker error in the form of

    [linker error] undefined reference to 'SDL_Init'

    and I get linker errors to everything sdl in the code also. I also get a linker error to winmain@16. This isn't a project but a source file. I am not going to create a project unless it is absolutely necessary. Please help.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Hanover Germany

    Re: SDL issues

    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: SDL issues

    Linker errors usually mean that you haven't told the linker that you are using certain libraries. You need to specifiy to the linker what .lib files SDL require.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.7.4)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.