Author Topic: SDL problem  (Read 285 times)

Offline FluroM

  • Single posting newcomer
  • *
  • Posts: 2
SDL problem
« on: February 19, 2020, 04:47:58 pm »
I used the SDL 2.0 wizard to generate my new SDL project. But when I tried to compile the project it gave me some errors come:
Code: [Select]
-------------- Build: Debug in Testing (compiler: My New compiler because Ii can)---------------

mingw32-g++.exe -LF:\C++\SDL\lib -o bin\Debug\Testing.exe obj\Debug\main.o   -lmingw32 -lSDL2main -lSDL2.dll -luser32 -lgdi32 -lwinmm -ldxguid
obj\Debug\main.o: In function `main':
F:/C++/Testing/main.cpp:5: undefined reference to `_imp__terminal_open'
F:/C++/Testing/main.cpp:9: undefined reference to `_imp__terminal_refresh'
F:/C++/Testing/main.cpp:12: undefined reference to `_imp__terminal_read'
F:/C++/Testing/main.cpp:14: undefined reference to `_imp__terminal_close'
obj\Debug\main.o: In function `Z14terminal_printiiPKc':
F:/C++/Testing/BearLibTerminal.h:460: undefined reference to `_imp__terminal_print_ext8'
collect2.exe: error: ld returned 1 exit status

in F:/C++/SDL/lib is the *.dll and in F:/C++/SDL/include are the headers. I have got windows 10 64x and I am using SDL 2.0 Mingw developer version and form there x86_64 folder.

SDL 2 link I used is here https://www.libsdl.org/download-2.0.php

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6899
    • My Best Post
Re: SDL problem
« Reply #1 on: February 19, 2020, 07:37:37 pm »
It worked for me. I downloaded SDL2-devel-2.0.10-mingw.tar.gz from the link you posted.

Post a full rebuild log and your compiler information!!!!
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.

Code: [Select]
x86_64-w64-mingw32-g++.exe -Wall -g -IC:/Library/SDL2-2.0.10/x86_64-w64-mingw32/include/SDL2 -c C:/Users/stahta01/devel/test/sdl2-64/main.cpp -o obj/Debug/main.o
x86_64-w64-mingw32-g++.exe -LC:/Library/SDL2-2.0.10/x86_64-w64-mingw32/lib -o bin/Debug/sdl2-64.exe obj/Debug/main.o   -lmingw32 -lSDL2main -lSDL2.dll -luser32 -lgdi32 -lwinmm -ldxguid
Output file is bin\Debug\sdl2-64.exe with size 429.47 KB
Running project post-build steps
XCOPY C:\Library\SDL2-2.0.10\x86_64-w64-mingw32\bin\*.dll bin\Debug\ /D /Y
0 File(s) copied
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline FluroM

  • Single posting newcomer
  • *
  • Posts: 2
Re: SDL problem
« Reply #2 on: February 19, 2020, 09:04:08 pm »
Well, I forgot about rebuilding it (only build it) and new thing happened:
Code: [Select]
-------------- Clean: Debug in Testing (compiler: My New compiler because Ii can)---------------

Cleaned "Testing - Debug"

-------------- Build: Debug in Testing (compiler: My New compiler because Ii can)---------------

mingw32-g++.exe -Wall -g -IF:\C++\SDL\include\SDL2 -c F:\C++\Testing\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LF:\C++\SDL\lib -o bin\Debug\Testing.exe obj\Debug\main.o   -lmingw32 -lSDL2main -lSDL2.dll -luser32 -lgdi32 -lwinmm -ldxguid
obj\Debug\main.o: In function `ZN9InitErrorC2Ev':
F:/C++/Testing/main.cpp:18: undefined reference to `SDL_GetError'
obj\Debug\main.o: In function `ZN3SDLC2Ej':
F:/C++/Testing/main.cpp:49: undefined reference to `SDL_Init'
F:/C++/Testing/main.cpp:52: undefined reference to `SDL_CreateWindowAndRenderer'
obj\Debug\main.o: In function `ZN3SDLD2Ev':
F:/C++/Testing/main.cpp:59: undefined reference to `SDL_DestroyWindow'
F:/C++/Testing/main.cpp:60: undefined reference to `SDL_DestroyRenderer'
F:/C++/Testing/main.cpp:61: undefined reference to `SDL_Quit'
obj\Debug\main.o: In function `ZN3SDL4drawEv':
F:/C++/Testing/main.cpp:67: undefined reference to `SDL_SetRenderDrawColor'
F:/C++/Testing/main.cpp:68: undefined reference to `SDL_RenderClear'
F:/C++/Testing/main.cpp:71: undefined reference to `SDL_RenderPresent'
F:/C++/Testing/main.cpp:89: undefined reference to `SDL_SetRenderDrawColor'
F:/C++/Testing/main.cpp:90: undefined reference to `SDL_RenderFillRect'
F:/C++/Testing/main.cpp:91: undefined reference to `SDL_RenderPresent'
F:/C++/Testing/main.cpp:92: undefined reference to `SDL_Delay'
F:/C++/IDE/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `[email protected]'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 3 second(s))
15 error(s), 0 warning(s) (0 minute(s), 3 second(s))

I am using MinGW compiler from the "codeblocks-17.12mingw-nosetup.zip" file.
Compiler settings:
Link libraries = mingw32, SDL2main, SDL2.dll, user32, gdi32, winmm, dxguid
SearchDirectories->compiler = F:\C++\SDL\include\SDL2
SearchDirectories->linker = F:\C++\SDL\lib

I think I am missing some libraries in the project folder.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12600
    • Travis build status
Re: SDL problem
« Reply #3 on: February 19, 2020, 11:56:48 pm »
What happens if you drop dll from SDL2.dll?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6899
    • My Best Post
Re: SDL problem
« Reply #4 on: February 20, 2020, 12:42:57 am »
Is your Compiler an 64 bit compiler?

Edit: Code::Blocks has yet to ship an 64 bit Compiler with C::B; therefore you need a different compiler or you need to use an 32 bit SDL2 library!

Tim S.
« Last Edit: February 20, 2020, 12:45:28 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org