Download and install Eclipse C/C++ dev tools (main update site of eclipse release)
- Now you have to connect all the libraries (both dynamic and static) needed for compilation. There is a slight bug in eclipse C/C++ dev tools on MacOS. The names of the libraries dont picked up very well, but I found a workaround to simulate linux enviroment or at least give eclipse what it needs to have.
- Add static and dynamic libs to build - Go to project proprieties -> C/C++ Build -> Settings -> MacOS X C++ linker->Libraries. Click add button in the upper part of the the window (Libraries (-l)). One after one add these (case sensitive!!!):
- System.B
- Carbon
- OpenGL
- IOKit
- Cocoa
- AppKit
- CoreFoundation
- OpenGL
- Irrlicht
- opencv_video.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_ts.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_objdetect.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_ml.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_legacy.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_imgproc.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_highgui.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_gpu.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_flann.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_features.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_core.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_contrlib.2.3.1 (or whatver version you have, use mdfind to determine)
- opencv_calib3d.2.3.1 (or whatver version you have, use mdfind to determine)
- Note: I am not sure if all theese opencv are necessary, but since all of them are dynamic it doesnt hurt to add them all. If linker is complaining about missing symbols you can always google them and check them by "$ nm -g library.dylib" Add the following to the down part of the window (Library search path(-L)), one after another:
- Add the following to the down part of the window (Library search path(-L)), one after another:
- /System/Library/Frameworks/Carbon.Framework/
- /System/Library/Frameworks/OpenGL.Framework/
- /System/Library/Frameworks/IOKit.Framework/ /
- System/Library/Frameworks/Cocoa.Framework/
- /System/Library/Frameworks/AppKit.Framework/
- /System/Library/Frameworks/CoreFoundation.Framework/
- /System/Library/Frameworks/OpenGL.Framework/Libraries/
- /usr/local/lib/
- /opt/local/lib/
- Note: it is also possible that you have some of these Something.Framework folders in /Developer/... SDk/... but if possible try to add the sytem native ones.
- Create the actual .dylibs with proper name - There is a "bug"ish in Eclipse CDT - Eclipse expects ANY dylib on the Mac OS system be named libSOMETHING.dylib or libSOMETHING.a ... Most of installed libraries (like e.g. Irrlicht) tend to keep this naming convention but most of system native libraries dont keep this naming convetion. Your code WONT compile unless you get the names right. How to fix it:
- Go to all the folders with frameworks one by one (that you have listed in the down part of the window in previous step
- There is one file just named by the name of the framework
- Make sure this file is a dylib by executing file SOMETHING - it should say --> "SOMETHING (Mach-O universal binary with 2 architectures) + and another 2 lines
- Copy (DO NOT OVERWRITE!!!) this file "SOMETHING" and name it to "libSOMETHING.dylib" Given example for OpenGL file:
$ cd /System/Library/Frameworks/OpenGL.Framework/ $ file OpenGL OpenGL: Mach-O universal binary with 2 architectures OpenGL (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 OpenGL (for architecture i386): Mach-O dynamically linked shared library i386 $ cp OpenGL libOpenGL.dylib
- Add static and dynamic libs to build - Go to project proprieties -> C/C++ Build -> Settings -> MacOS X C++ linker->Libraries. Click add button in the upper part of the the window (Libraries (-l)). One after one add these (case sensitive!!!):
- Add header files for irrlicht and opencv - Go to project proprieties -> C/C++ General -> Paths and Symbols and select GNU C++ from Languages. Then click add-> and add paths /opt/local/include and /usr/local/include/irrlicht
- Compile arhell (dont forget to have src folder set as source code folder - if it is not so, just add source folder and name it "src")