How to make a C++ projection using Root 6.26.04 class library?

___i want to make a C++ projection using Root 6.26.04 class library,
on Root 6.24.02, when the CMakeLists.txt file contains the content below:

cmake_minimum_required(VERSION 3.5)

find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net Graf Graf3d Gpad ROOTDataFrame Tree TreePlayer Rint )
include_directories(${CMAKE_SOURCE_DIR} ${ROOT_INCLUDE_DIRS})

add_executable(${PROJECT_NAME} NormalC++.cpp)
target_link_libraries(${PROJECT_NAME} ${ROOT_LIBRARIES})

everythings work ok, but on Root 6.26.04, it fails,
what is the right contents in CMakeLists.txt?

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.26.04
Platform: Windows10
Compiler: VS2022

How does it fail exactly? Can you try with a name without the ++ (something like NormalCpp instead of NormalC++)?

when using CMake to configure the projection, the information list below:

it seems the library files were not found.

After build by VS2022, the .exe file can not be executed correctly, the information list below:

the .cpp and projection file are already named NormalC.
but the problems are still exist.

Maybe, something is wrong with my computer,
everything works ok in another computer.

That should not be a problem, just ignore it.

This is because you should either start from a x86 or x64 Native Tools Command Prompt for VS 2022, or call C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat (or vcvars64.bat) before starting your program.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.