![]() ![]() Related: Should SDL2_LIBRARY_DIRS contain SDL2main or not? SDL2::SDL2 doesn’t seem to automatically link against SDL2main (at least on Windows/vcpkg), there’s an explicit SDL2::SDL2main for that.This is also a problem of sdl2-config.cmake, of course, not just one of making SDL2Config.cmake behave like it.Those usually provided $) which for non-MSVC is not necessary (as the libdir is also set in SDL2_LIBRARIES).Īnd keep in mind that for a more generic cmake config (that’s not specific for windows), even more if()s are needed to handle non-Windows platforms - and to make it work with vcpkg’s SDL2 package one would probably also have to handle SDL2 vs SDL2d… Originally, SDL2 didn’t ship any cmake files, so people used custom FindSDL2.cmake scripts based on the SDL1.2 FindSDL.cmake shipped by CMake itself ( example - yes, this is older than SDL 2.0.0!). This is about building applications/games that use SDL2 with CMake - with -dev packages from packages managers (of Linux distros, vcpkg, whatever) or the official Development Libraries. & C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\mingw\bin\G_~1.EXE -g CMakeFiles/SDL_ParticleFireSimulation.dir/main.First, to avoid misunderstandings: This is not about building SDL2 with CMake. When I tried to build project, I got this error :Ĭmd.exe /C "cd. I can use SDL.h library now, But still I cannot build the project. I deleted the SDL2 file from MinGW and have reset the CMake and gave me the solutionĬ:/Users/ozgur/SDL2-2.28.1/x86_64-w64-mingw32/include/SDL2īut still, SDL.h does not seem. Users/valve/release/SDL2/SDL2-2.28.1-source/foo-圆4/./src/main/windows/SDL_windows_main.c:80: undefined reference to `SDL_main'Ĭollect2.exe: error: ld returned 1 exit status "Ĭ:\Program Files\JetBrains\CLion 2023.1.2\bin\mingw\bin/ld.exe: C:/MinGW/lib/libSDL2main.a(SDL_windows_main.o): in function `main_getcmdline': ![]() & C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\mingw\bin\G_~1.EXE -g CMakeFiles/SDL_ParticleFireSimulation.dir/ -o SDL_ParticleFireSimulation.exe -Wl,-out-implib,libSDL_ -Wl,-major-image-version,0,-minor-image-version,0 -lmingw32 -mwindows C:/MinGW/lib/libSDL2main.a C:/MinGW/lib/ -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 & cd. I built the project by using this section.Ĭmd.exe /C "cd. Build files have been written to: C:/Users/ozgur/GitHub/SDL_ParticleFireSimulation/cmake-build-debug Found SDL2: mingw32 -mwindows C:/MinGW/lib/libSDL2main.a C:/MinGW/lib/ Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success ![]() Performing Test CMAKE_HAVE_LIBC_PTHREAD Check for working CXX compiler: C:/Program Files/JetBrains/CLion 2023.1.2/bin/mingw/bin/g++.exe - skipped Check for working C compiler: C:/Program Files/JetBrains/CLion 2023.1.2/bin/mingw/bin/gcc.exe - skipped The CXX compiler identification is GNU 11.2.0 The C compiler identification is GNU 11.2.0 "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\圆4\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/JetBrains/CLion 2023.1.2/bin/ninja/win/圆4/ninja.exe" -G Ninja -S C:\Users\ozgur\GitHub\SDL_ParticleFireSimulation -B C:\Users\ozgur\GitHub\SDL_ParticleFireSimulation\cmake-build-debug Makefile:137: recipe for target 'ImageOfCLife' failed Mingw32-make.exe: *** Error 2ĬMakeFiles\ImageOfCLife.dir\build.make:107: recipe for target 'ImageOfCLife.exe' failedĬMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/ImageOfCLife.dir/all' failedĬMakeFiles\Makefile2:101: recipe for target 'CMakeFiles/ImageOfCLife.dir/rule' failed Linking C executable ImageOfCLife.exeĬ:/mingw/bin/./lib/gcc/mingw32/9.2.0/././././mingw32/bin/ld.exe: c:/mingw/bin/./lib/gcc/mingw32/9.2.0/./././libmingw32.a(main.o):(.text.startup+0xc0): undefined reference to error: ld returned 1 exit status Building C object CMakeFiles/ImageOfCLife.dir/main.c.obj Scanning dependencies of target ImageOfCLife Build files have been written to: C:/Users/Clement/Documents/coding/ImageOfCLife/cmake-build-debug "C:\Program Files\JetBrains\CLion 2020.3.1\bin\cmake\win\bin\cmake.exe" -build C:\Users\Clement\Documents\coding\ImageOfCLife\cmake-build-debug -target ImageOfCLife -j 6 Set(CMAKE_MODULE_PATH $)Īnd here is what I get. The only change initially was upgrading to the new CLion version. It worked about 6 months ago, but only recently picked up my project again. I'm trying to get SDL2 to work with CLion in Windows 7. I've read and tried all previous posts both here and elsewhere but all is in vain.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |