At first after installing ROOT go to your ROOT installation directory and run ‘sh /bin/thisroot.sh’

Make sure your environment variables are set. In MacOS they are declared in ~/.bash_profile file. For example, I have:

export ROOTSYS=/Users/petrstepanov/root-6.04.08
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$ROOTSYS/lib:$DYLD_LIBRARY_PATH

after editing your ‘.bash_profile’ run from terminal ‘source .bash_profile’

g++ `root-config --cflags --libs` -L $ROOTSYS/lib -lRooFit -lRooFitCore -lHtml -lMinuit -lFumili your-program-name.cpp -o your-program-name.o
./your-program-name.o

1. Go to Project -> Properties -> C/C++ Build -> Environment. You should have ROOTSYS, LD_LIBRARY_PATH and DYLD_LIBRARY_PATH set there.

2. Go to Project -> Properties -> C/C++ Build -> Settings -> MacOS X C++ Linker -> Miscellaneous. On the right notice Miscellaneous text field. Paste there identical flags/parameters that worked for you when you compiled from console. I have all other settings under “MacOS X C++ Linker” default/empty.

3. Go to Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous. Paste same string there. Since this string has all necessary flags for the compiler I cleared default eclipse settings under “GCC C++ Compiler”. E.G. no include path, no language standart, none optimization.

That’s pretty much it. Below please see the some Eclipse errors that showed up in the console. I briefly state the solutions there

  • Eclipse Output: atomic is not implemented
    Solution you have to use C++11 compiler. This is achieved by adding following parameters -stdlib=libc++ -std=c++11 to the compiler directives.
  • Eclipse Output: symbol(s) not found for architecture x86_64
    Solution: you probably forgot to include one of the libraries (g++ parameter). Doublecheck following flags: -L/path-to-root-libraries/ – make sure path is correct. Also try including include more libraries. The ones that I was missing were -lRooFit -lRooFitCore -lFumili. After adding these flags problem gone.
  • Eclipse Output: unknown type name ‘…’ (in my case – ‘RooAddPdf’ and ‘RooGausian’)
    Solution: cyclic dependency in roofit #include “…” files. Remove all include lines in your code and start adding them as-demanded by compiler again.
  • Eclipse Output: can’t link with a main executable file for architecture x86_64
    Solution: add “-c” to compiler flags – eclipse will not try to link your source file
    http://stackoverflow.com/questions/6309773/link-error-on-mac-osx-10-6-7
Дополнительно:  Компьютерра: Вызываем синий экран смерти Windows

P.S. You might need a list of g++ compiler flags:
https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Option-Summary.html#Option%20Summary