Author Topic: [Solved] libSDL : No such File  (Read 4904 times)

Offline shadoww

  • Single posting newcomer
  • *
  • Posts: 4
[Solved] libSDL : No such File
« on: December 13, 2014, 12:01:07 am »
Hello ! Thanks for comming here !

I know that is a known problem, and I've searched a lot, but it didn't work at all...
I'm on Windows 7, CB 13.12:

I have my little main.cpp, my project in c++, and I use SDL :

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>

In my folder, I have :

my source file
include/SDL/[all the SDL.h I need]
lib/[libSDL.dll.a , libSDL.la , libSDLmain.a , SDL_image.lib , SDL_ttf.lib ]

I linked this libs (right click in the project, build options, linker settings, added /sudoku(my folder with the project)/lib/libSDLmain.a then libSDL.dll.a)
I know that the libSDLmain.a needs to be before the libSDL.dll.a )


But...

mingw32-g++.exe: error: \lib\libSDLmain.a: No such file or directory
mingw32-g++.exe: error: \lib\libSDL.dll.a: No such file or directory


And it is the only two errors that I have : Here is the complete build log :

Quote
-------------- Build: Debug in sudoku (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o bin\Debug\sudoku.exe obj\Debug\Grille.o obj\Debug\InterfaceGraphique.o obj\Debug\main.o   -lSDLmain -lSDL.dll  \lib\libSDLmain.a \lib\libSDL.dll.a lib\libSDLmain.a lib\libSDL.dll.a C:\Users\ME\Desktop\sudoku\lib\libSDL.dll.a C:\Users\ME\Desktop\sudoku\lib\libSDLmain.a C:\Users\ME\Desktop\sudoku\lib\SDL_image.lib C:\Users\ME\Desktop\sudoku\lib\SDL_ttf.lib -mwindows
mingw32-g++.exe: error: \lib\libSDLmain.a: No such file or directory
mingw32-g++.exe: error: \lib\libSDL.dll.a: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I've searched a lot, but I already did the two common problems : main before all, and link them...



Thanks for the solution !

(And sorry for my english, It's not my native language)
 



« Last Edit: December 15, 2014, 08:32:06 am by shadoww »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7176
    • My Best Post
Re: libSDL : No such File
« Reply #1 on: December 13, 2014, 05:13:31 am »
From http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Quote
For your project :
- Right click on the project then select Build options
- Select the directories tab
- Add the required paths for compiler and linker.
- Add your specific libraries in the linker tab.
- Pay attention to project settings and target settings.

Add the path to the linker libraries in "Linker" tab under "search directories" tab.
Add just the library names in the "Link Libraries" box under the "Linker Settings" tab.

If after doing that it still does not work post the full build log to show the current issues.

Tim S.


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 shadoww

  • Single posting newcomer
  • *
  • Posts: 4
Re: libSDL : No such File
« Reply #2 on: December 13, 2014, 11:47:35 am »
Thanks for your answer :
I added "lib" in my search directorie, in the linker tab
But it's the same problem, same log :



Quote
-------------- Build: Debug in sudoku (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Llib -o bin\Debug\sudoku.exe obj\Debug\Grille.o obj\Debug\InterfaceGraphique.o obj\Debug\main.o   -lSDLmain -lSDL.dll  \lib\libSDLmain.a \lib\libSDL.dll.a -lSDLmain -lSDL.dll C:\Users\Théo\Desktop\sudoku\lib\libSDL.dll.a C:\Users\Théo\Desktop\sudoku\lib\libSDLmain.a C:\Users\Théo\Desktop\sudoku\lib\SDL_image.lib C:\Users\Théo\Desktop\sudoku\lib\SDL_ttf.lib -mwindows
mingw32-g++.exe: error: \lib\libSDLmain.a: No such file or directory
mingw32-g++.exe: error: \lib\libSDL.dll.a: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

The worst part is that CB detect the corrects libs !
Quote
\lib\libSDLmain.a \lib\libSDL.dll.a -lSDLmain -lSDL.dll C:\Users\Théo\Desktop\sudoku\lib\libSDL.dll.a C:\Users\Théo\Desktop\sudoku\lib\libSDLmain.a

PS : I think that it is the complete log ?

PS2 : I successfuly build each file separated, but not all of them (main.cpp + Interface.cpp + Interface.h)
So, I tried tu put them all in the main.cpp (all includes too) : I'm trying, moving lines, erase them...

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: libSDL : No such File
« Reply #3 on: December 13, 2014, 12:46:27 pm »
Why are you trying to link 'libSDLmain.a' and 'libSDL.dll.a' twice?
-------------- Build: Debug in sudoku (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Llib -o bin\Debug\sudoku.exe obj\Debug\Grille.o obj\Debug\InterfaceGraphique.o obj\Debug\main.o   -lSDLmain -lSDL.dll  \lib\libSDLmain.a \lib\libSDL.dll.a -lSDLmain -lSDL.dll C:\Users\Théo\Desktop\sudoku\lib\libSDL.dll.a C:\Users\Théo\Desktop\sudoku\lib\libSDLmain.a C:\Users\Théo\Desktop\sudoku\lib\SDL_image.lib C:\Users\Théo\Desktop\sudoku\lib\SDL_ttf.lib -mwindows
mingw32-g++.exe: error: \lib\libSDLmain.a: No such file or directory
mingw32-g++.exe: error: \lib\libSDL.dll.a: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I think you have 2 separate instances of these same libs included, try removing one of them.

Offline shadoww

  • Single posting newcomer
  • *
  • Posts: 4
Re: libSDL : No such File
« Reply #4 on: December 13, 2014, 01:39:11 pm »
Thanks, but it is'nt enough for  CB :

I removed all the links, and the build log became :

Quote
-------------- Build: Debug in sudoku (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o bin\Debug\sudoku.exe obj\Debug\Grille.o obj\Debug\InterfaceGraphique.o obj\Debug\main.o    \lib\libSDLmain.a \lib\libSDL.dll.a
mingw32-g++.exe: error: \lib\libSDLmain.a: No such file or directory
mingw32-g++.exe: error: \lib\libSDL.dll.a: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

So, it automatically add it, and only one time, with the main.a before the dll.a, but it isn't enough

PS : if I link them, it will compile them two times ><
 

Offline codeman_nz

  • Single posting newcomer
  • *
  • Posts: 5
Re: libSDL : No such File
« Reply #5 on: December 14, 2014, 09:31:30 pm »
Are you using SDL or SDL2?

Offline shadoww

  • Single posting newcomer
  • *
  • Posts: 4
Re: libSDL : No such File
« Reply #6 on: December 15, 2014, 08:31:51 am »
SDL, not SDL2
But I finally succeded : I removed all my links, just let "-lSDL"etc, andd it worked : I think that CB automatically found my libs, and didn't liked that I guide him... I don't know =/

Thanks to you three !