Code::Blocks Forums
User forums => Help => Topic started by: shadoww 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 :
-------------- 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)
-
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 (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)
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.
-
Thanks for your answer :
I added "lib" in my search directorie, in the linker tab
But it's the same problem, same log :
-------------- 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 !
\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...
-
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.
-
Thanks, but it is'nt enough for CB :
I removed all the links, and the build log became :
-------------- 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 ><
-
Are you using SDL or SDL2?
-
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 !