0

I am trying to compile a c++ program, which uses the TF1 library of the ROOT-framework, with the g++ compiler.

I tried

I already tried

g++ a.cpp -o 'root-config --cflags --glibs' 

But that just gives me the error

g++: error: no such file or directory: 'root-config --cflags --glibs'

I am very new to both ROOT and C++ so help is very mucha appreciated!

TwoStones
  • 113
  • 5
  • I don't know ROOT but I can tell you that `'root-config --cflags glibs'` is definitely a command, but the `-o` is trying to interpret it as an output file. To produce an executable you'll have to specify a file name like `-o a`. – joshwilsonvu Jun 27 '19 at 19:23
  • in addition to what @jwilson says, single quotes `'` just mark a string literal and won't call the `root-config` program. (which is essentially what the error message says). subprocesses are called with backticks `, or (like in the answer below) with dollar and parentheses (often preferable https://stackoverflow.com/questions/9405478 or http://mywiki.wooledge.org/BashFAQ/082) – pseyfert Jun 28 '19 at 08:10

1 Answers1

2

You must check with:

g++ a.cpp $(root-config --cflags --glibs) -o a 
Picaud Vincent
  • 10,518
  • 5
  • 31
  • 70