Microsoft C++ std::runtime_error in FromCSV


e3.cpp (2.7 KB)
CMakeLists.txt (525 Bytes)

Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.28
Platform: windows 10
Compiler: visual studio community 2022 C++


Abnormal
I run the df014_CSVDataSource.C File Reference in visual studio, find a error and I need help to solve it。please see the attachments.

Do you have any warning when building your application? Like for example:

The C++ standard in this build does not match ROOT configuration (201703L); this might cause unexpected issues. And please make sure you are using the -Zc:__cplusplus compilation flag

Because I don’t understand why you have these lines:

if (CMAKE_VERSION VERSION_GREATER 3.12)
  set_property(TARGET e3 PROPERTY CXX_STANDARD 20)
endif()

I.e. I don’t see how the C++ standard depends on the CMake version… You must use the same standard than ROOT itself (c++17)

No such warning when building.
I have change c++20 to c++17, the problem is also being.
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET e3 PROPERTY CXX_STANDARD 17)
endif()

OK, so I can compile and start the process without any error, but I would need also the data (csv) file in order to try

df014_CsvDataSource_MuRun2010B_cpp.zip (1.2 MB)

OK, thanks, I have no problem with your code:

Do you run it in visual studio 2022 and in windows 10?

on the VS 2022 command prompt, Windows 11 (but it shouldn’t matter)


Can you try it by Ctrl + F5?

Same thing

I think I know what’s going on. On Windows, one cannot mix Debug/Release builds (runtime). Can you try to build in RelWithDebInfo mode?

Let me say it again: not in debug mode

1 Like

I run it in release mode, it is ok now.
Thanks very much.

1 Like

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