Hi,
You need to install CMake tools in Visual Studio.
Create CMake project.
In default CMakePreset.json file Modify: "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++"
Add content in the CMakeList file.
# CMakeList.txt : CMake project for CMakeProject1, include source and define
# project specific logic here.
#
# Add source to this project's executable.
add_executable (CMakeProject1 "CMakeProject1.cpp" "CMakeProject1.h")
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET CMakeProject1 PROPERTY CXX_STANDARD 20)
endif()
# TODO: Add tests and install targets if needed.
add_library(YourLibraryName SHARED "Header.h" "Header.cpp")
set_target_properties(YourLibraryName PROPERTIES LIBRARY_OUTPUT_DIRECTORY "")
install(TARGETS YourLibraryName DESTINATION "")
Click the icon to switch to CMake View.
Right click the project->Build ALL.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.