I’m trying to move my development from Emacs to Xcode, but I have trouble when the compiler want to link with the ROOT libraries.
What I do:
Create a new project: “Carbon C++ Application”
In the info section for the project I :
change Arch. to i386 (del. PPC)
HEADER_SEARCH_PATHS = /Applications/root/include
LIBRARY_SEARCH_PATHS = /Applications/root/lib
Trying to compile gives me the following error:
Line Location Tool:0: collect2: ld returned 1 exit status
Line Location Tool:0: symbol(s) not found
Line Location Tool:0: __static_initialization_and_destruction_0(int, int)in test.o
Line Location Tool:0: “TVersionCheck::TVersionCheck(int)”, referenced from:
I am not in front of my mac, so here are just a few guesses about what could be wrong but without any warranty.
Why a Carbon application ? I would simply take a C++ project (if it exists) or an empty project. Or are you really developing something with Carbon ?
Try to add the libraries directly in the project (but keep your settings as they are).
Right click on your project and select “Add…” → “Add an existing framework”. There you choose in /Applications/root/lib the libraries you need.
I don’t think I had a clean option in Xcode 3.0 without having to set up all the compiler and linker options.
Now I upgraded to 3.1 and choose “C++ Tool” which is a basic command-line template.
[quote=“Barth”]
Try to add the libraries directly in the project (but keep your settings as they are).
Right click on your project and select “Add…” → “Add an existing framework”. There you choose in /Applications/root/lib the libraries you need.
Let me know if it helps or not. Good luck
Barth[/quote]
It did! I can compile now, but how do I figure out which libs to include, because it complains at run-time if you link with something that isn’t used:
ld: Library not loaded: /Users/bellenot/ROOT/osx104_ia32_gcc401/root/lib/libCore.dylib
Referenced from: /Users/mdj/Desktop/slet/build/Debug/slet
Reason: image not found
Trace/BPT trap
Now I upgraded to 3.1 and choose “C++ Tool” which is a basic command-line template.
[/quote]
Good, this is better.
[quote=“mdj”]
[quote=“Barth”]
Let me know if it helps or not. Good luck
Barth[/quote]
It did! I can compile now, but how do I figure out which libs to include, because it complains at run-time if you link with something that isn’t used:
ld: Library not loaded: /Users/bellenot/ROOT/osx104_ia32_gcc401/root/lib/libCore.dylib
Referenced from: /Users/mdj/Desktop/slet/build/Debug/slet
Reason: image not found
Trace/BPT trap
— Even more weird I’m not bellenot :S[/quote]
Well, I don’t think it is complaining about the libraries you don’t use but more likely because it can’t load the libraries.
It seems to be looking for libCore in the wrong place. As if you had an hard-coded reference coming directly from Bertrand Bellenot’s computer. Are you sure you are launching the correct executable ? Betrand do you have any idea how this is possible ?
I will think more about it and keep you informed if I think about something.
was there any further progress on this issue. i am getting the same bellenot problem and all of my attempts to find a solution have failed.
thanks,
james
Hallo!
i also want to use root with xcode. i did everyting that is written above. but i get the errors e.a.
"error: TF1.h: No such file or directory"
so he does not find the headder files.
what could be the problem?
my runsearch paths: /Users/iRobert148/Applications/root/lib
header search path: /Users/iRobert148/Applications/root/include
everyting else is the same and he still doesnt find the headers.
When looking in the Xcode log pane, hoe does the compilevstatement look like? Is there any -I statement with the ROOT include path. Please double check your settings.
To see the “Build Results” pane, click first in the upper left “project” icon. Then the “Build Results” pane is the most right one in the right pane. I’ve added the example ROOT based Xcode project that works for me.
Build ROOT-based-app of project ROOT-based-app with configuration Debug
CompileC build/ROOT-based-app.build/Debug/ROOT-based-app.build/Objects-normal/x86_64/main.o main.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
cd /Users/iRobert148/Downloads/ROOT-based-app
setenv LANG en_US.US-ASCII
/Applications/Xcode/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Applications/Xcode/SDKs/MacOSX10.6.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/ROOT-based-app-generated-files.hmap -I/Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/ROOT-based-app-own-target-headers.hmap -I/Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/ROOT-based-app-all-target-headers.hmap -iquote /Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/ROOT-based-app-project-headers.hmap -F/Users/iRobert148/Downloads/ROOT-based-app/build/Debug -I/Users/iRobert148/Downloads/ROOT-based-app/build/Debug/include -I/Users/rdm/root/include -I/Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/DerivedSources/x86_64 -I/Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/DerivedSources -D_REENTRANT -pthread -c /Users/iRobert148/Downloads/ROOT-based-app/main.cpp -o /Users/iRobert148/Downloads/ROOT-based-app/build/ROOT-based-app.build/Debug/ROOT-based-app.build/Objects-normal/x86_64/main.o
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:8:26: error: TApplication.h: No such file or directory
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:9:21: error: TCanvas.h: No such file or directory
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:10:19: error: TLine.h: No such file or directory
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:11:24: error: TPaveLabel.h: No such file or directory
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp: In function ‘int main(int, char**)’:
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:15: error: ‘TApplication’ was not declared in this scope
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:15: error: expected ;' before 'theApp' /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:17: error: 'TCanvas' was not declared in this scope /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:17: error: 'c' was not declared in this scope /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:17: error: expected type-specifier before 'TCanvas' /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:17: error: expected;’ before ‘TCanvas’
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:18: error: ‘theApp’ was not declared in this scope
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:20: error: ‘TPaveLabel’ was not declared in this scope
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:20: error: ‘hello’ was not declared in this scope
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:20: error: expected type-specifier before ‘TPaveLabel’
/Users/iRobert148/Downloads/ROOT-based-app/main.cpp:20: error: expected ;' before 'TPaveLabel' /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:22: error: 'quit' was not declared in this scope /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:22: error: expected type-specifier before 'TPaveLabel' /Users/iRobert148/Downloads/ROOT-based-app/main.cpp:22: error: expected;’ before ‘TPaveLabel’
i cant find the rdm content in your target settings,
when i build a project with my settings, i get that result:
Build test of project test with configuration Debug
CompileC build/test.build/Debug/test.build/Objects-normal/x86_64/main.o main.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
cd /Users/iRobert148/Desktop/test
setenv LANG en_US.US-ASCII
/Applications/Xcode/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Applications/Xcode/SDKs/MacOSX10.6.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-generated-files.hmap -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-own-target-headers.hmap -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-all-target-headers.hmap -iquote /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-project-headers.hmap -F/Users/iRobert148/Desktop/test/build/Debug -I/Users/iRobert148/Desktop/test/build/Debug/include -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/DerivedSources/x86_64 -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/DerivedSources -c /Users/iRobert148/Desktop/test/main.cpp -o /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/Objects-normal/x86_64/main.o
/Users/iRobert148/Desktop/test/main.cpp:8:26: error: TApplication.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:9:21: error: TCanvas.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:10:19: error: TLine.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:11:24: error: TPaveLabel.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp: In function ‘int main(int, char**)’:
/Users/iRobert148/Desktop/test/main.cpp:15: error: ‘TApplication’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:15: error: expected ;' before 'theApp' /Users/iRobert148/Desktop/test/main.cpp:17: error: 'TCanvas' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:17: error: 'c' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:17: error: expected type-specifier before 'TCanvas' /Users/iRobert148/Desktop/test/main.cpp:17: error: expected;’ before ‘TCanvas’
/Users/iRobert148/Desktop/test/main.cpp:18: error: ‘theApp’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: ‘TPaveLabel’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: ‘hello’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: expected type-specifier before ‘TPaveLabel’
/Users/iRobert148/Desktop/test/main.cpp:20: error: expected ;' before 'TPaveLabel' /Users/iRobert148/Desktop/test/main.cpp:22: error: 'quit' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:22: error: expected type-specifier before 'TPaveLabel' /Users/iRobert148/Desktop/test/main.cpp:22: error: expected;’ before ‘TPaveLabel’
when i open your project, c++ cflags, linker flags… are empty. maybe i check it at the wrong place?
project/edit active targer i correct, isnt it?
but i add it, maybe check the pictures if its correct,
again de results:
Build test of project test with configuration Debug
CompileC build/test.build/Debug/test.build/Objects-normal/x86_64/main.o main.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
cd /Users/iRobert148/Desktop/test
setenv LANG en_US.US-ASCII
/Applications/Xcode/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Applications/Xcode/SDKs/MacOSX10.6.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-generated-files.hmap -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-own-target-headers.hmap -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-all-target-headers.hmap -iquote /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/test-project-headers.hmap -F/Users/iRobert148/Desktop/test/build/Debug -I/Users/iRobert148/Desktop/test/build/Debug/include -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/DerivedSources/x86_64 -I/Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/DerivedSources -c /Users/iRobert148/Desktop/test/main.cpp -o /Users/iRobert148/Desktop/test/build/test.build/Debug/test.build/Objects-normal/x86_64/main.o
/Users/iRobert148/Desktop/test/main.cpp:8:26: error: TApplication.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:9:21: error: TCanvas.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:10:19: error: TLine.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp:11:24: error: TPaveLabel.h: No such file or directory
/Users/iRobert148/Desktop/test/main.cpp: In function ‘int main(int, char**)’:
/Users/iRobert148/Desktop/test/main.cpp:15: error: ‘TApplication’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:15: error: expected ;' before 'theApp' /Users/iRobert148/Desktop/test/main.cpp:17: error: 'TCanvas' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:17: error: 'c' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:17: error: expected type-specifier before 'TCanvas' /Users/iRobert148/Desktop/test/main.cpp:17: error: expected;’ before ‘TCanvas’
/Users/iRobert148/Desktop/test/main.cpp:18: error: ‘theApp’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: ‘TPaveLabel’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: ‘hello’ was not declared in this scope
/Users/iRobert148/Desktop/test/main.cpp:20: error: expected type-specifier before ‘TPaveLabel’
/Users/iRobert148/Desktop/test/main.cpp:20: error: expected ;' before 'TPaveLabel' /Users/iRobert148/Desktop/test/main.cpp:22: error: 'quit' was not declared in this scope /Users/iRobert148/Desktop/test/main.cpp:22: error: expected type-specifier before 'TPaveLabel' /Users/iRobert148/Desktop/test/main.cpp:22: error: expected;’ before ‘TPaveLabel’
still doesnt works )-;
but if i tage your project and chance alle …/rdm/… against my path, it works FINE!
strange, i really would like to know what is missing in my configs, i compared them without and found no difference. but ok, finaly i can use root with xcode (-;
thx alot
In case someone else is stuck with this:
Judging by the error/warning messages I had the same or at least a very similar problem with the
Xcode project I created.
Fons’ project worked for me and just from visual inspection in the project/target settings everything
seemed to be identical (after replacing the /rdm/ part of the paths).
I even used the same main.cpp.
A diff of the package content of the xcodeproj-file showed some newlines (\n) to be the problem,
that are all but invisible in the Xcode GUI.
E.g. “/include[color=#FF0000]\n[/color]”
Turns out they were left over after copying and pasting the output of root-config into the Xcode GUI.
After removing them everything else worked “as advertised”.