C/C++ Cpp in visual studio: cmake and being able to compile

  • Thread starter Thread starter cppIStough
  • Start date Start date
AI Thread Summary
To compile the `run_logger.cpp` file using CMake in Visual Studio, the CMakeLists.txt needs to be adjusted. The `add_executable` command should reference the target name without the `.cpp` extension, so it should be `add_executable(run_logger apps/run_logger.cpp)`. Additionally, ensure that the include directories are specified using `include_directories(include)` to allow the compiler to find `logger.h`. After making these changes, running CMake should generate the necessary build files, enabling successful compilation of the `run_logger.cpp` file.
cppIStough
Messages
24
Reaction score
2
I have the following directory of c++ files, and it looks like:

d.lib
--apps
----run_logger.cpp
----CMakeLists.txt
--include
----logger.h
--source
----logger.cpp

I want to build run_logger.cpp. I'm using Visual Studio. My CMakeLists is
Code:
cmake_minimum_required(VERSION 3.10)

project(d_lib)

# Add your source files
file(GLOB_RECURSE SOURCES "source/*.cpp" "include/*.h")

# Add your executable
add_executable(run_logger.cpp ${SOURCES})

How can I get this to compile? Thanks for your help.[/code]
 
Last edited:
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top