Thread: Code::Blocks - MinGW - Problems with GLEW and SDL2

  1. #1
    Registered User
    Join Date
    Jun 2016
    Posts
    2

    Code::Blocks - MinGW - Problems with GLEW and SDL2

    Hi,
    im trying to get GLEW and SDL2 to work in CodeBlocks.

    Here is my CodeBlocks setup:

    #defines:
    Code::Blocks - MinGW - Problems with GLEW and SDL2-defines-png

    Linker settings:
    Code::Blocks - MinGW - Problems with GLEW and SDL2-linker_settings-png

    Search directories:
    Code::Blocks - MinGW - Problems with GLEW and SDL2-search_dirs-png

    ------------------------------------------

    Test code:
    Code:
    #include <iostream>
    #include <GL/glew.h>
    #include <SDL.h>
    
    
    int main()
    {
    
    
        std::cout << "Hello World!" << std::endl;
    
    
        glewInit();
        SDL_Init(SDL_INIT_EVERYTHING);
    
    
        return 0;
    }
    I always get these errors:
    Code:
    ||=== Build: Debug in RayglerFramework (compiler: GNU GCC Compiler) ===|
    obj\Debug\main.o||In function `Z8SDL_mainv':|
    C:\Users\lukas\Documents\CodeBlocks\RayglerFramework\main.cpp|10|undefined reference to `glewInit@0'|
    C:\Users\lukas\Documents\CodeBlocks\RayglerFramework\main.cpp|11|undefined reference to `SDL_Init'|
    e:\users\lukas\programme\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'|
    ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
    How can I fix the errors?

    I am very thankful for every reply.
    Last edited by Raygler; 06-26-2016 at 05:50 AM.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,729
    Those are all Visual Studio library files, MinGW can't use them. A MinGW lib would be like "libSDL2.a"
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Jun 2016
    Posts
    2
    Thank you, it's working now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL2 Codeblocks error
    By russiancircles in forum Game Programming
    Replies: 2
    Last Post: 05-08-2014, 06:08 AM
  2. Problems with MinGW
    By p0l4rb34r in forum C Programming
    Replies: 13
    Last Post: 01-08-2011, 05:21 AM
  3. Random file IO problems in MinGW GCC
    By JungleJesus in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2010, 10:53 AM
  4. MinGW causing problems with sprintf()
    By sedavidw in forum C Programming
    Replies: 6
    Last Post: 01-14-2010, 05:37 AM
  5. Problems with GLEW
    By nightcrawler in forum Game Programming
    Replies: 0
    Last Post: 05-22-2008, 03:42 AM

Tags for this Thread