Issue
I am having an issue with getting my SDL libraries loaded into Eclipse properly. I included the libraries SDL2main and SDL2, and linked to them under properties>C/C++ General/>Paths and Symbols>libraries.
I get this error when I try to run my code.
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lC:\SDL2-2.26.4\i686-w64-mingw32\lib\libSDL2main.a
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lC:\SDL2-2.26.4\i686-w64-mingw32\lib\libSDL2.a
Any clue why I am getting this error or how to fix it?
I initially had my folder with my libraries somewhere random, but I moved it to be in my C drive directly in case that might be the issue, but it did not help.
Solution
The library names and library path must be separated. In the compiler command, the path should appear in the -L
option. Under the -l
(lowercase ell) option, only the library name should appear (without lib
prefix and extension .a
).
In Eclipse, only the library names (without path, without lib
prefix and without .a
extension) should be provided under C/C++ General > Paths and Symbols > Libraries. The path should be provided under C/C++ General > Paths and Symbols > Library Paths.
Hence in your case, the library path C:\SDL2-2.26.4\i686-w64-mingw32\lib
must be provided under "Library Paths" and the library names SDL2main
and SDL2
must be provided under "Libraries".
Answered By - nielsen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.