Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[C++] SDL2 - Undefined references to functions at school

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
peter_irich
Posts: 1403
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 11 times

Re: [C++] SDL2 - Undefined references to functions at school

#16 Post by peter_irich »

Functions with very similar names are in library libSDL2-2.0.so.0 -> libSDL2-2.0.so.0.2.0 in package libsdl2-2.0-0.
For examlpe, SDL_RenderCopy but not Renderer, SDL_CreateRGBSurfaceFrom. Check your source.

Peter.
Last edited by peter_irich on 2017-02-12 19:53, edited 1 time in total.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: [C++] SDL2 - Undefined references to functions at school

#17 Post by phenest »

commodorejohn wrote:

Code: Select all

commodorejohn@devuan:~$ gcc sdltest.c `sdl2-config --cflags --libs` -o sdltest
/tmp/ccCtWq9W.o: In function `main':
sdltest.c:(.text+0x15f): undefined reference to `SDL_CreateRGBSurfaceWithFormat'
sdltest.c:(.text+0x2c2): undefined reference to `SDL_RendererFillRect'
sdltest.c:(.text+0x326): undefined reference to `SDL_RendererCopy'
sdltest.c:(.text+0x341): undefined reference to `SDL_RendererPresent'
collect2: error: ld returned 1 exit status
I really don't understand why this is happening. Any advice on resolving this issue?
What is the output of:

Code: Select all

sdl2-config --cflags --libs
And what is the contents of your sdltest.c source code?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

commodorejohn
Posts: 35
Joined: 2011-06-29 10:26

Re: [C++] SDL2 - Undefined references to functions at school

#18 Post by commodorejohn »

peter_irich wrote:Functions with very similar names are in library libSDL2-2.0.so.0 -> libSDL2-2.0.so.0.2.0 in package libsdl2-2.0-0.
For examlpe, SDL_RenderCopy but not Renderer, SDL_CreateRGBSurfaceFrom. Check your source.
Thank you, well-spotted. The "render"/"renderer" typo was the bulk of it, and the other problem was that I was going off the SDL wiki without noticing that SDL_CreateRGBSurfaceWithFormat wasn't added until 2.0.5. It builds and runs without issue now.

Post Reply