I solved my problem!
Besides what already hereby described in the previous posts, I had another problem: Xcode 7 (actually starting from Xcode 4) saves the executable file into a “/Users/Username/Library/Developer/Xcode/DerivedData” folder by default.
When launching the executable (either by double clicking on it on that location or by building and running it directly from the Xcode IDE) the stderr was telling me the following message:
Error in TCling::RegisterModule: cannot find dictionary module GUIDict_rdict.pcm
In fact the executable was not able to find the GUIDict_rdict.pcm file.
In order to have it running it was sufficient to copy that “GUIDict_rdict.pcm” file in the same folder of the executable.
For my convenience I modified the path of the DerivedData folder in Xcode by following these instructions: See: meandmark.com/blog/2011/04/xcode … you-built/
and selecting the option “Project relative location” from the Xcode File–>project settings menu, while copying the GUIDict_rdict.pcm file in that folder.
To be more precise, in case of any use for somebody else who might read this post, I summarise the sequence of things I did in order to have a code compiled under Xcode:
0. After upgrading to El Capitan (10.11.1) and upgraded to the last Xcode (7.1.1), from a Terminal shell I installed the Command line tools: xcode-select --install
- In Xcode I created a new project --> Command Line Tool application, selecting C++ as language
- I created new files as I needed (e.g. main.cpp, GUI.cpp, GUI.hpp, etc…)
- In a Terminal shell I executed the command:
root-config --libs
and got:
-L/Applications/root_v6.04.08/lib -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -stdlib=libc++ -lm -ldl
- Then I copied that string to the “Other Linker Flags” in the build settings pane in Xcode
- In a Terminal shell I executed the command:
root-config --cflags
and got:
-pthread -stdlib=libc++ -std=c++11 -m64 -I/Applications/root_v6.04.08/include
-
Then I copied that string to the “Other C++ flags” in the build settings pane in Xcode
-
I have also specified: /Applications/root_v6.04.08/lib into the “Runpath search paths” in the build settings pane and: /Applications/root_v6.04.08/include into the “Header search paths”.
-
I have created a “LinkDef.hpp” file containing:
#ifndef LinkDef_hpp
#define LinkDef_hpp
#ifdef CLING
#pragma link C++ class GUI+; // this statement is related to my “GUI” class I defined in the GUI.cpp and
//GUI.hpp
#endif
#endif /* LinkDef_hpp */ -
I created the dictionary from a Terminal shell with:
rootcling -f GUIDict.cpp -c GUI.hpp LinkDef.hpp -
I added the GUIDict.cpp file to my Xcode project and copied the GUIDict_rdict.pcm (created by rootcling) in the same folder where the executable was going to be created.
-
Compiled from Xcode everything works fine and without error messages!
P.S. Xcode under El Capitan does not see the ROOT related environment variables (as far as any other else) specified in the .bash_profile:
discussions.apple.com/thread/73 … 0&tstart=0
At the moment I could not find a better way of specifying the root base installation folder if not manually specifying it as described above.
This way the executable, as a standalone application, was able to properly find the dictionary.
Erik.