I use window10 and vs code to compile some source code. I can compile the code but when I run the .exe file. Nothing shows up. I got this error.
My cmakefile is as follows:
cmake_minimum_required(VERSION 3.11.3)
set(CMAKE_CXX_STANDARD 17)
project(membot)
set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.1.4")
set(wxWidgets_LIB_DIR "C:/wxWidgets-3.1.4/lib/gcc_dll"
CACHE PATH "wxWidgets_LIB_DIR ")
find_package(wxWidgets REQUIRED COMPONENTS core base)
include(${wxWidgets_USE_FILE})
file(GLOB project_SRCS src/*.cpp)
add_executable(membot ${project_SRCS})
target_link_libraries(membot ${wxWidgets_LIBRARIES})
target_include_directories(membot PRIVATE ${wxWidgets_INCLUDE_DIRS})
I don't know how to solve it. I also tried to include the path in the c_cpp_properties.json, but still doesn't work.
I found my solution.
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
instead of find_package(wxWidgets REQUIRED COMPONENTS core base)
My final cmakefile.txt is like this
cmake_minimum_required(VERSION 3.11.3)
set(CMAKE_CXX_STANDARD 17)
project(membot)
set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.1.4")
set(wxWidgets_LIB_DIR "C:/wxWidgets-3.1.4/lib/gcc_dll")
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
include(${wxWidgets_USE_FILE})
file(GLOB project_SRCS src/*.cpp)
add_executable(membot ${project_SRCS})
target_link_libraries(membot ${wxWidgets_LIBRARIES})
target_include_directories(membot PRIVATE ${wxWidgets_INCLUDE_DIRS})
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release clean
to clean the dynamic libraries and use mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release clean
to clean the static libraries. Then I use this mingw32-make -j8 -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 VENDOR=custom
to build static libraries.cmake -G "MinGW Makefiles" ..
and make
to compile the source code. It succeeded.