_ROOT Version: 6.19
_Platform: MacOS Catalina 10.15.4
_Compiler: clang 11.0.0
When I run without compiling, like root main.cpp
, everything works well.
But when I compile using CLion, everything except canvas works well. Only the canvas-thing is not showing.
I’ve done
gSystem->ProcessEvents()
-
gSystem->ProcessEvents()
x2 - wait for input at the end of draw
CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(nn)
set(CMAKE_CXX_STANDARD 14)
find_package(ROOT 6.19 REQUIRED)
add_executable(nn main.cpp)
target_link_libraries(nn PUBLIC
ROOT::Core
ROOT::Imt
ROOT::RIO
ROOT::Net
ROOT::Hist
ROOT::Graf
ROOT::Graf3d
ROOT::Gpad
ROOT::ROOTVecOps
ROOT::Tree
ROOT::TreePlayer
ROOT::Rint
ROOT::Postscript
ROOT::Matrix
ROOT::Physics
ROOT::MathCore
ROOT::Thread
ROOT::MultiProc
ROOT::ROOTDataFrame)
main.cpp
#include <iostream>
#include <chrono>
#include "TRandom3.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TSystem.h"
using std::cout;
using std::endl;
int main() {
auto* rnd = new TRandom3;
rnd->SetSeed(std::chrono::high_resolution_clock::now().time_since_epoch().count());
auto* c1 = new TCanvas("c1","c1");
cout << rnd->Gaus() << endl;
cout << rnd->Rndm() << endl;
int x[] = {1,2,3};
int y[] = {1,2,3};
c1->cd();
auto* graph = new TGraph(3, x, y);
graph->Draw();
c1->Update();
gSystem->ProcessEvents();
gSystem->ProcessEvents();
return 0;
}
CLion build messages
Compiling 'main.cpp' ...
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/yonggyulee/CLionProjects/nn/cmake-build-debug --target CMakeFiles/nn.dir/main.cpp.o -- -j 6 -f /Users/yonggyulee/CLionProjects/nn/cmake-build-debug/CMakeFiles/nn.dir/build.make --always-make
Building CXX object CMakeFiles/nn.dir/main.cpp.o
/Library/Developer/CommandLineTools/usr/bin/c++ -DVECCORE_ENABLE_VC -isystem /Applications/root_v6.19.02/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++14 -o CMakeFiles/nn.dir/main.cpp.o -c /Users/yonggyulee/CLionProjects/nn/main.cpp
Compilation of 'main.cpp' finished