Проблема с SDL.

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by 0o Chris o0, 30 Mar 2012.

  1. 0o Chris o0

    0o Chris o0 New Member

    Joined:
    16 Oct 2011
    Messages:
    142
    Likes Received:
    1
    Reputations:
    0
    Скачал с оф. сайта SDL 1.2, добавил себе все хедеры, добавил библиотеки, при компиляции:
    Code:
    #include <iostream>
    #include <stdio.h>
    #include "SDL.h"
    
    using namespace std;
    
    int main()
    {
        if (SDL_Init(SDL_INIT_VIDEO) < 0) {
          printf("Unable to initialize SDL", SDL_GetError());
        }
        SDL_Surface *screen;
        screen = SDL_SetVideoMode(1366, 768, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
        if (screen == NULL) {
          printf("Unable to set 1366x768 video format", SDL_GetError());
        }
        SDL_Quit();
        return 0;
    }
    
    Получаю ошибки:
    Code:
    obj\Debug\main.o || In function `Z8SDL_mainv':|
    E:\projects\SDL2\main.cpp |9| undefined reference to `SDL_Init'|
    E:\projects\SDL2\main.cpp |10| undefined reference to `SDL_GetError'|
    E:\projects\SDL2\main.cpp |13| undefined reference to `SDL_SetVideoMode'|
    E:\projects\SDL2\main.cpp |15| undefined reference to `SDL_GetError'|
    E:\projects\SDL2\main.cpp |17| undefined reference to `SDL_Quit'|
    c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(main.o):main.c|| undefined reference to `WinMain@16'|
    
    В чем может быть проблема?
     
  2. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,732
    Likes Received:
    809
    Reputations:
    231
    В том что проект не слинкован с необходимыми либами.
     
    _________________________
  3. 0o Chris o0

    0o Chris o0 New Member

    Joined:
    16 Oct 2011
    Messages:
    142
    Likes Received:
    1
    Reputations:
    0
    У меня добавлены SDL.lib и SDLmain.lib, надо что-то другое?