Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example.c:(.text+0x13d): undefined reference to SDL_Init'` #24

Open
paulmenzel opened this issue Aug 29, 2022 · 3 comments
Open

example.c:(.text+0x13d): undefined reference to SDL_Init'` #24

paulmenzel opened this issue Aug 29, 2022 · 3 comments

Comments

@paulmenzel
Copy link

On Debian sid/unstable with libsdl2-dev 2.24.0+dfsg-1, I get:

$ git log --oneline --no-decorate -1
1dcbae1 Merge pull request #17 from MichielP1807/master
$ pkg-config --cflags --libs sdl2
-D_REENTRANT -I/usr/include/SDL2 -lSDL2
$ cc `pkg-config --cflags --libs sdl2` -o gifplay gifdec.c example.c
/usr/bin/ld: /tmp/ccxL4R2w.o: in function `main':
example.c:(.text+0x13d): undefined reference to `SDL_Init'
/usr/bin/ld: example.c:(.text+0x146): undefined reference to `SDL_GetError'
/usr/bin/ld: example.c:(.text+0x15d): undefined reference to `SDL_Log'
/usr/bin/ld: example.c:(.text+0x197): undefined reference to `SDL_CreateWindowAndRenderer'
/usr/bin/ld: example.c:(.text+0x1a0): undefined reference to `SDL_GetError'
/usr/bin/ld: example.c:(.text+0x1b7): undefined reference to `SDL_Log'
/usr/bin/ld: example.c:(.text+0x21f): undefined reference to `SDL_SetWindowTitle'
/usr/bin/ld: example.c:(.text+0x283): undefined reference to `SDL_SetRenderDrawColor'
/usr/bin/ld: example.c:(.text+0x28f): undefined reference to `SDL_RenderClear'
/usr/bin/ld: example.c:(.text+0x29b): undefined reference to `SDL_RenderPresent'
/usr/bin/ld: example.c:(.text+0x2d2): undefined reference to `SDL_CreateRGBSurface'
/usr/bin/ld: example.c:(.text+0x2e6): undefined reference to `SDL_GetError'
/usr/bin/ld: example.c:(.text+0x2fd): undefined reference to `SDL_Log'
/usr/bin/ld: example.c:(.text+0x373): undefined reference to `SDL_PollEvent'
/usr/bin/ld: example.c:(.text+0x397): undefined reference to `SDL_Delay'
/usr/bin/ld: example.c:(.text+0x3a1): undefined reference to `SDL_GetTicks'
/usr/bin/ld: example.c:(.text+0x3c9): undefined reference to `SDL_LockSurface'
/usr/bin/ld: example.c:(.text+0x449): undefined reference to `SDL_MapRGB'
/usr/bin/ld: example.c:(.text+0x487): undefined reference to `SDL_MapRGB'
/usr/bin/ld: example.c:(.text+0x4ae): undefined reference to `SDL_MapRGB'
/usr/bin/ld: example.c:(.text+0x52a): undefined reference to `SDL_UnlockSurface'
/usr/bin/ld: example.c:(.text+0x53d): undefined reference to `SDL_CreateTextureFromSurface'
/usr/bin/ld: example.c:(.text+0x55b): undefined reference to `SDL_RenderCopy'
/usr/bin/ld: example.c:(.text+0x567): undefined reference to `SDL_RenderPresent'
/usr/bin/ld: example.c:(.text+0x573): undefined reference to `SDL_DestroyTexture'
/usr/bin/ld: example.c:(.text+0x578): undefined reference to `SDL_GetTicks'
/usr/bin/ld: example.c:(.text+0x5bd): undefined reference to `SDL_Delay'
/usr/bin/ld: example.c:(.text+0x5e8): undefined reference to `SDL_FreeSurface'
/usr/bin/ld: example.c:(.text+0x5f4): undefined reference to `SDL_DestroyRenderer'
/usr/bin/ld: example.c:(.text+0x600): undefined reference to `SDL_DestroyWindow'
/usr/bin/ld: example.c:(.text+0x605): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
@sulqadari
Copy link

I encounterd with the similar issue on FreeBSD 13.1.
Do you have any clue how to fix that or maybe you already have found a workaround?

Any suggestions are highly appreciated.

@qqwqqw689
Copy link

cc pkg-config --cflags --libs sdl2 -o example gifdec.c example.c

I use this and encounter the same problem.

@qqwqqw689
Copy link

qqwqqw689 commented Dec 31, 2024

I' fix it by using gcc -o example example.c gifdec.c -I/usr/local/include/SDL2 -lSDL2.I'll submit a pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants