Critical error detected c0000374 with minimal example


ROOT Version: 6.38.04
Platform: Windows
Compiler: Visual Studio 2026 (18.3.3)


I cannot get the simplest thing to run. I want to use ROOT in my c++ app and without even writing any special code, just including “TGraphErrors.h” compiels but results in error c0000374 without specifying any of my code. The call stack is:

ntdll.dll!00007ffef1bf7555() Unbekannt
ntdll.dll!00007ffef1b7d929() Unbekannt
ntdll.dll!00007ffef1b067b2() Unbekannt
ntdll.dll!00007ffef1bfd91a() Unbekannt
ntdll.dll!00007ffef1afed9b() Unbekannt
ntdll.dll!00007ffef1b30cb5() Unbekannt
ntdll.dll!00007ffef1afd141() Unbekannt
ntdll.dll!00007ffef1afcd14() Unbekannt
ntdll.dll!00007ffef1afe2c9() Unbekannt
ntdll.dll!00007ffef1afce54() Unbekannt
ntdll.dll!00007ffef1afcd14() Unbekannt
ntdll.dll!00007ffef1af7da9() Unbekannt
KernelBase.dll!00007ffeee600877() Unbekannt
libCore.dll!00007ffdbd95ebc6() Unbekannt
libCore.dll!00007ffdbd85ab98() Unbekannt
libCore.dll!00007ffdbd853ab1() Unbekannt
libCore.dll!00007ffdbd84f40b() Unbekannt
libCore.dll!00007ffdbd7f15aa() Unbekannt
ucrtbase.dll!00007ffeee9fe686() Unbekannt
libCore.dll!00007ffdbdaadb5e() Unbekannt
libCore.dll!00007ffdbdaadccf() Unbekannt
ntdll.dll!00007ffef1c3f7ea() Unbekannt
ntdll.dll!00007ffef1aebc23() Unbekannt
ntdll.dll!00007ffef1ae979c() Unbekannt
ntdll.dll!00007ffef1b775aa() Unbekannt
ntdll.dll!00007ffef1b775d6() Unbekannt
ntdll.dll!00007ffef1b775d6() Unbekannt
ntdll.dll!00007ffef1b775d6() Unbekannt
ntdll.dll!00007ffef1b9d49d() Unbekannt
ntdll.dll!00007ffef1b9b630() Unbekannt
ntdll.dll!00007ffef1b9b41a() Unbekannt
ntdll.dll!00007ffef1bcb07e() Unbekannt

the code is:

#pragma once

#include <wx/frame.h>
#include <wx/app.h>
#include "TGraphErrors.h"

class MyFrame1 : public wxFrame 
{
public:
	MyFrame1( wxWindow* parent = NULL, 
		wxWindowID id = wxID_ANY, 
		const wxString& title = wxEmptyString, 
		const wxPoint& pos = wxDefaultPosition, 
		const wxSize& size = wxSize( 500,300 ), 
		long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) :
		wxFrame(parent, id, title, pos, size, style)
	{
		SetSizer(new wxBoxSizer(wxVERTICAL));

		this->SetSizeHints(wxDefaultSize, wxDefaultSize);
		this->Centre(wxBOTH);
	}
	~MyFrame1(){}
	void onButtonClicked(wxCommandEvent &evt) {

	}
};

class MyApp : public wxApp {
	virtual bool OnInit() {
		MyFrame1* mainFrame = new MyFrame1();
		mainFrame->Show();
		SetTopWindow(mainFrame);

		return TRUE;
	}
};

wxIMPLEMENT_APP(MyApp);

I link to libHist.lib and libCore.lib, both dlls are copied into the exe folder, ROOTSYS and Path are set.
What could be wrong?
Thank you!

maybe this note is the problem: “You must download the binary built with the exact same version of Visual Studio (and Python) than the one installed on your system.“
since there is not visual studio 2026 binary?

Welcome to the ROOT Forum!
Can you tell us how you build your project?

i followed the instructions and substituted the cmake command with

cmake -G"Visual Studio 18 2026" -A x64 -Thost=x64 -DCMAKE_INSTALL_PREFIX=<installdir> <sourcedir>

Can I see your CMakeLists.txt? And I see you are also using wxWindow. Can you try with a very simple example, without wxWindow, to start with?

I also tried the precompiled binaries of the latest stable release 6.26.10 with the same result.

#pragma once
#include "TGraphErrors.h"
#include <iostream>

int main() {
	std::cout << "Hello World";
}

EDIT: The error disappears when I remove all .dll files from the exe folder. But the build output shows “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“

CMakeLists.txt:

cmake_minimum_required(VERSION 4.3.1)
set(CMAKE_MODULE_PATH “C:/root_v6.38.04/src/cmake/modules”)
set(_CMAKE_CHECK_ENABLED_LANGUAGES “C;CXX;RC”)
set(CMAKE_C_COMPILER “C:/Program Files/Microsoft Visual Studio/18/Enterprise/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x86/cl.exe”)
set(CMAKE_C_COMPILER_ID “MSVC”)
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_VERSION “19.50.35725.0”)
set(CMAKE_CXX_COMPILER “C:/Program Files/Microsoft Visual Studio/18/Enterprise/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x86/cl.exe”)
set(CMAKE_CXX_COMPILER_ID “MSVC”)
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_VERSION “19.50.35725.0”)
set(CMAKE_RC_COMPILER “C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x86/rc.exe”)
set(CMAKE_RC_COMPILER_ID “”)
set(CMAKE_RC_COMPILER_LOADED 1)
set(CMAKE_RC_COMPILER_VERSION “”)

project(CheckCUDA LANGUAGES CUDA)
file(WRITE “${CMAKE_CURRENT_BINARY_DIR}/result.cmake" "set(CMAKE_CUDA_COMPILER "${CMAKE_CUDA_COMPILER}”)
")

OK, your CMakeLists.txt looks weird… It doesn’t show what you are trying to build (i.e. there is no add_executable nor add_library)
Here is a simple example:

cmake_minimum_required(VERSION 3.12)

set(PROJECT_NAME test)
project(${PROJECT_NAME})

find_package(ROOT REQUIRED)
set(CMAKE_CXX_FLAGS "${ROOT_CXX_FLAGS}")

add_executable(test main.cpp)
target_include_directories(test PRIVATE ${ROOT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test PRIVATE ${ROOT_LIBRARIES})

Here, the important line is set(CMAKE_CXX_FLAGS "${ROOT_CXX_FLAGS}"), so you produce binary compatible code.
Otherwise, you have to manually specify the proper compiler flags. I.e.

set(CMAKE_CXX_STANDARD 17)
add_compile_options(/Zc:__cplusplus)

And no need to move files (DLLs) around, if you properly call root\bin\thisroot.bat, everything is set up for you.

Thank you!

I continued to try different things and started using the precompiled binaries. I saw that everything works just fine when I install root with the installer and let it add to the Path variable.

BUT: I will have to distribute my app to other systems and would like to not have to install root everywhere. So I was hoping I could just copy the necessary dlls into the exe folder. I used the dependency walker to see which dlls are linked on my developer machine und copied those into the exe folder on a different test system without root installed. This did not work and resulted in the afformentioned

Critical error detected c0000374
(1a24.770): Break instruction exception - code 80000003 (first chance)
ntdll!RtlIsZeroMemory+0xa2:

Is there no way to NOT having to install root on every system my app should run on?

Well, not really. ROOT needs not only its DLLs, but also its plugins, icons (pixmap), fonts, config files, and so on… All relative to %ROOTSYS%. And it also needs the MSVC runtime environment, to be able to find the C++ headers (for the JIT interpreter). Now, depending on what subset of libraries you need, one might find a solution, but it would require quite some time and effort to investigate what minimal set would be needed.

Aaaah, alright, then my problem is solved, thank you!

I guess I underestimated ROOT´s complexity. :slight_smile:

1 Like