So I got this project for wxwidgets
I use cmake with vscode
Here is my cmake file I use:
cmake_minimum_required(VERSION 3.10)
project(Platformer VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
file(GLOB RESOURCE_SOURCES "src/*.cpp")
add_executable(Platformer ${RESOURCE_SOURCES})
# Add hdrs directory to include path so #include <main.h> works
target_include_directories(Platformer PUBLIC "${PROJECT_SOURCE_DIR}/hdrs")
find_package(wxWidgets REQUIRED COMPONENTS net core base)
if(wxWidgets_USE_FILE)
include(${wxWidgets_USE_FILE})
endif()
target_link_libraries(Platformer ${wxWidgets_LIBRARIES})
Here is my presets file:
{
"version": 8,
"configurePresets": [
{
"name": "GCC 14.2.0 x86_64-linux-gnu",
"displayName": "GCC 14.2.0 x86_64-linux-gnu",
"description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_C_COMPILER": "/usr/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/bin/g++",
"CMAKE_BUILD_TYPE": "Debug"
}
}
]
}
the folder structure is that there is a hdrs and src folder which contains the headers and the source files
When I make a new file named main.cpp and one named main.h in their respective folders
It says that main.h cannot be found HOWEVER it is there and the intelisense even detects it
it wont compile I cleaned and rebuilded the cmake many times
But when u rename it It works (main.h and main.cpp to App.h and App.cpp for example)
ANY OTHER FILE OTHER THAN THE MAIN.h and MAIN.cpp works
(Also by compiling it errors too)
Here is the error
main.h: No such file or directory
It is a wxwidgets project btw
And I used the official guide for the cmake (vscode)