#CMake issue in Visual Studio Code (compiler/linker?)
33 messages · Page 1 of 1 (latest)
@gaunt pollen has reached level 3. GG!
Here's the output log error, which is why I'm sure it's a linker issue
i wouldn't even know where to start with manually linking files
I tried link.exe /INCLUDE main.cpp GameManager.cpp
or something similar to that. I also checked in environment variables and INCLUDE does not exist there inspite of the compiler obviously being installed (since i'm able to build single files)
i tried searching around online but a lot more people use GNU to compile, so the solutions always include "use g++", which i obviously don't have to use.
I added the CMake extension and manually created a makefile to attach it to. The project now builds after some tweaking and alterations to what was already there, but there's still huge glaring issues with CMake
The term 'make.exe' is not recognized as the name of a cmdlet, function, script file, or operable program.
mainly this issue, i'm not sure if cmake isn't configured correctly, or if i'm just doing everything wrong.
CMake issue in Visual Studio Code (compiler/linker?)
changing title to reflect the current issue
What's your cmake?
can you explain a bit more what you mean by this? do you want me to send my cmake files, or show you the current configuration for it?
bumping this
also moved along a lot now. i have the correct SDL2 files on my computer finally (the repo is very unclear on which is the correct library)
i have the c_cpp_properties and CMakeLists files configured to include the SDL2 library, and from the developer terminal i have done both cmake . . and cmake --build ., but the build is broken apparently because it can't find my header files.
still unable to include SDL.h without it throwing an error. have checked c_cpp_properties, CMakeLists and tasks json files to ensure they're setup correctly. any ideas?
Try #include <SDL2/SDL.h>
Can you show your CMakeLists.txt?
cmake_minimum_required(VERSION 3.10) project(GameProject) set(SDL2_DIR "C:/SDL2/cmake") //contains SDL2-config.cmake! list(APPEND CMAKE_PREFIX_PATH ${SDL2_DIR}) find_package(SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIRS}) include_directories(${CMAKE_SOURCE_DIR}) add_executable(GameProject main.cpp GameManager.cpp) target_link_libraries(GameProject ${SDL2_LIBRARIES})
I do! It's in the root folder, along with GameManager.cpp and main.cpp
Cmake needs to know that this file exists
Add the GameManager.h to your add_executable()
Or do something like target_include_directories(GameProject PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
I wasn't aware you had to include headers there?
oh wait a second, including GameManager.h isn't my issue, that's already resolved
the issue is specifically with SDL.h not being included, despite having it included
and it looks like i get no errors until i build (from newly opening vscode through developer terminal), and then SDL.h is flagged as problematic
feels like i've exhausted my options
Please don't long people for help
And please post the error you're getting if you want help
i've set this to resolved now, fixed it myself - my apologies