cmakeminimumrequired(VERSION 3.18) project(Main) addlibrary(lib SHARED test.cpp)…
Jump to turn (9)
- 1cmakeminimumrequired(VERSION 3.18) project(Main) addlibrary(lib SHARED test.cpp)
- 2#include // Include this header to use the Windows API functions #include int ma
- 3is this possinle to link a specific link file in the middle of the cpp code
- 4#include // Include this header to use the Windows API functions #include int ma
- 5can we use dlopen on s=windows
- 6is this possible to have an error handling message for the "if (loop)" condition
- 7La procÚdure spÚcifiÚe est introuvable
- 8Error loading library: %1 nÆest pas une application Win32 valide.
- 9cmakeminimumrequired(VERSION 3.18) project(Main) addlibrary(lib SHARED test.cpp)
- User
cmake_minimum_required(VERSION 3.18) project(Main) add_library(lib SHARED test.cpp) add_executable(Main main.cpp) target_link_libraries(Main PRIVATE lib)
this cmake creates a .lib but it asks me .dll
- Assistant
The CMake script you provided is creating a shared library (.dll on Windows) instead of a static library (.lib on Windows).
To create a static library, you need to change the
SHAREDkeyword toSTATICin theadd_librarycommand:cmakecmake_minimum_required(VERSION 3.18) project(Main) add_library(lib STATIC test.cpp) add_executable(Main main.cpp) target_link_libraries(Main PRIVATE lib)This will create a static library (.lib) instead of a shared library (.dll).
Remember to regenerate your build files using CMake after making this change.