***break*** segmentation violation

Hello eb!
I got a problem while running a c++ exercise in which I read a file and put the doubles from the .txt file to a histogram TH1F.
I get these error messages:

~ Fatal error: requested non-existing drawable 0

~ This drawable not found among allocated/deleted drawables

*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[] (no debug info)
[/usr/local/opt/root/lib/root/libGpad.so] TPad::PaintBorder(short, bool) (no debug info)
[/usr/local/opt/root/lib/root/libGpad.so] TPad::Clear(char const*) (no debug info)
[/usr/local/opt/root/lib/root/libGpad.so] TCanvas::Clear(char const*) (no debug info)
[/usr/local/opt/root/lib/root/libHist.so] TH1::Draw(char const*) (no debug info)
[/Users/nigresson/Documents/UNI/Secondo anno/laboratorio2/info/lez9/./a.out] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)

Instead of a screen dump can you post a small macro reproducing this crash ?

I just found out that the problem is TApplication: I ran the rest of the program and worked perfectly

#include <iostream>
#include <cmath>
#include <TCanvas.h>
#include <TApplication.h>
#include <TH1F.h>
#include <fstream>

using namespace std;

int main (int argc, char **argv) {

	double x;
	TH1F *myHisto = new TH1F("myHisto", "Data from a file", 100, 0, 10);
	TCanvas *myCanv = new TCanvas("myCanv", "Data from a file", 0, 0, 700, 500);
	TApplication *myApp = new TApplication("myApp", NULL, NULL);

	ifstream InFile (argv[1]);

	while (true) {
		InFile >>x;
		if (InFile.eof()==true)



	myCanv->Print("histo.png", "png");


	delete myCanv;
	delete myHisto;
	return 0;

I’m using macOS High Sierra by the way…may be crucial

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