OF in eclipse on a Mac

So, I’ve been trying to get OF working eclipse on my mac and here’s what I’ve got so far:

I dragged the OF code from the XCode download to an executable C++ “Hello World” project.

In my Project Properties, I go to C/C++ Build>Settings>Tool Settings>MacOS X C++ Linker>Miscellaneous

And I add Linker Flags:
-framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework GLUT -framework OpenGL -framework QuickTime

Then, in my Project Properties, I go to C/C++ General>Paths and symbols>GNU C++>Includes and add all the dirs in the OF dirs. This is a pain in the ass. So, I built a little Java program to go find these dirs and put them into the xml format that’s in the .cprojects file. Then open this xml into your .cprojects. So you don’t have to generate it, I’ll include it here:

  
<option id="gnu.cpp.compiler.option.include.paths.237110109" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freeimage/include}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/utils}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/other/OF_serialTest/applet}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/movieGrabberExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/addons}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/communication}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/textureExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freetype/include/include/freetype2/freetype/config}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/moviePlayerExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/soundPlayerExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/app}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/polygonExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/imageLoaderExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/video}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/graphicsExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/sound}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/test/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/eventsExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/fmodex/inc}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/windowExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freetype/include/include/freetype2/freetype/cache}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/imageSaverExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/GLee}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/rtAudio}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/openFrameworks/graphics}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/fontsExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/.metadata/.plugins/org.eclipse.cdt.make.core}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/audioInputExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freetype/include/include/freetype2/freetype}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/advancedGraphicsExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/textureScreengrabExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freetype/include/include/freetype2/freetype/internal}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/serialExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/audioOutputExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/app/soundPlayerFFTExample/src}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/freetype/include/include}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/wiring}&quot;"/>  
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/test3/of_preRelease_v0.04_xcode/libs/rtAudio/asio}&quot;"/>  
</option>  

So, it seems like it’s just about to compile, when i get a bunch of errors like:

…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp:18: warning: ignoring #pragma export on
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp:254: warning: ignoring #pragma export off
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp: In function ‘ASIOError ASIOInit(ASIODriverInfo*)’:
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.h:485: error: previous declaration of ‘ASIOError ASIOInit(ASIODriverInfo*)’ with ‘C++’ linkage
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp:45: error: conflicts with new declaration with ‘C’ linkage
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp: In function ‘ASIOError ASIOExit()’:
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.h:513: error: previous declaration of ‘ASIOError ASIOExit()’ with ‘C++’ linkage
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp:96: error: conflicts with new declaration with ‘C’ linkage
…/of_preRelease_v0.04_xcode/libs/rtAudio/asio/asio.cpp: In function ‘ASIOError ASIOStart()’:

So, I’m stuck? Any ideas?

Matt

great !

I think you are getting the asio code of RT_AUDIO in there somehow…

to get that to compile you’ll need to compile against ASIO – only necessary if you have some really fancy card that you want use asio with. if not, then remove it.

see rtAudio documentation, you might need to put a #define somewhere saying something like “using core audio”

hope that helps!!
zach

I think we’re almost there.

Ok, so now, in addition to what I was doing before, I’m excluding the following directories:

of_preRelease_v0.04_xcode/other/OF_serialTest
of_preRelease_v0.04_xcode/app
of_preRelease_v0.04_xcode/libs/rtAudio/asio

to exclude a dir in eclipse, simple control click on it, then scroll down to “exclude from build” and select both release and debug mode.

The asio is being exluded for the reasons you mentioned. I’m excluding “app” because there are multiple files with “main” in it. Alternatively, you can just exclude all but one of them, I guess. I copied over wiring to try to make OF_serialTest, but there seemed to be a library I was missing for the wiring library. I may look into this later, but for now, it wasn’t necessary.

It seems like I’m close, but I think I have an issue at linkage? Here’s what I’m getting:

Building target: test3
Invoking: MacOS X C++ Linker
g++ -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework GLUT -framework OpenGL -framework QuickTime -o “test3” ./src/main.o ./src/testApp.o ./of_preRelease_v0.04_xcode/libs/rtAudio/RtAudio.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/video/ofQtUtils.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/video/ofVideoGrabber.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/video/ofVideoPlayer.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/utils/ofMath.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/utils/ofUtils.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/sound/ofSoundPlayer.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/sound/ofSoundStream.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/graphics/ofGraphics.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/graphics/ofImage.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/graphics/ofTexture.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/graphics/ofTrueTypeFont.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/communication/ofSerial.o ./of_preRelease_v0.04_xcode/libs/openFrameworks/app/ofAppRunner.o ./of_preRelease_v0.04_xcode/libs/GLee/GLee.o
/usr/bin/ld: Undefined symbols:
_FMOD_ChannelGroup_SetVolume
_FMOD_ChannelGroup_Stop
_FMOD_Channel_GetFrequency
_FMOD_Channel_GetPosition
_FMOD_Channel_IsPlaying
_FMOD_Channel_SetFrequency
_FMOD_Channel_SetMode
_FMOD_Channel_SetPan
_FMOD_Channel_SetPaused
_FMOD_Channel_SetPosition
_FMOD_Channel_SetVolume
_FMOD_Channel_Stop
_FMOD_Sound_GetLength
_FMOD_Sound_Release
_FMOD_System_Close
_FMOD_System_Create
_FMOD_System_CreateSound
_FMOD_System_GetMasterChannelGroup
_FMOD_System_GetSpectrum
_FMOD_System_Init
_FMOD_System_PlaySound
_FreeImage_AllocateT
_FreeImage_Clone
_FreeImage_ConvertFromRawBits
_FreeImage_ConvertTo24Bits
_FreeImage_ConvertTo32Bits
_FreeImage_ConvertToGreyscale
_FreeImage_ConvertToRawBits
_FreeImage_DeInitialise
_FreeImage_FIFSupportsReading
_FreeImage_FlipVertical
_FreeImage_GetBPP
_FreeImage_GetBits
_FreeImage_GetColorType
_FreeImage_GetFIFFromFilename
_FreeImage_GetFileType
_FreeImage_GetHeight
_FreeImage_GetWidth
_FreeImage_Initialise
_FreeImage_Load
_FreeImage_Rescale
_FreeImage_Save
_FreeImage_Unload
_FT_Done_Face
_FT_Done_FreeType
_FT_Get_Char_Index
_FT_Init_FreeType
_FT_Load_Glyph
_FT_New_Face
_FT_Render_Glyph
_FT_Set_Char_Size

Any thoughts?

Thank Zach!

Matt

great - you are close

looks like you are missing the following libraries in the linking process…

fmod, freeType, freeImage

if you add them (they’re in the mac release) it should compile –

take care!
zach

So, I can compile, but now the executable doesn’t run. Let’s start with the good news:

The last step to get to compilation:

Open up the project properties, go to C/C++ Build>Settings>Tool Settings>Miscellaneous

under “other objects” click the add button and add
of_preRelease_v0.04_xcode/fmodex/lb/libfmodex.dylib
of_preRelease_v0.04_xcode/freetype/lb/freetype.a
of_preRelease_v0.04_xcode/freeimage/lb/freeimage.a

Now it compiles. YAY!

Now for the bad news. When I run my executable, I get:

dyld: Library not loaded: ./libfmodex.dylib
Referenced from: /Users/matthewparker/Documents/cpp/workspace/test3/Debug/test3
Reason: image not found

So, I assume I somehow have to point the executable to the libs? Is this an argument I pass?

I think we’re almost home. If this works, I’ll zip up my project and send it along so others can see it.

Thanks,
Matt

I can explain this.

There is a script which is run by Xcode after linking, which copies the fmod dynamic library inside the app package and tells the app to look for the fmod dynamic library there.

This is unfortunately the only way we can use fmod (and maybe another reason to ger rid of it).

Here is the script (which is just a shell script executed by xcode).

  
cp -f ../../libs/fmodex/lib/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/libfmodex.dylib"  
install_name_tool -change ./libfmodex.dylib @executable_path/libfmodex.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"   

The TARGET_BUILD AND PRODUCT_NAME are xcode defines that refer to the directory where the openFrameworks.app is and the name of the app.

Matt,

I’ve been sorta working parallel with you in the Linux world and I just posted what I did in the Linux section:

http://forum.openframeworks.cc/t/of-in-eclipse-on-linux/435/2

Your posts here were helpful. Perhaps you can glean some info off of what I did if you run into any more troubles. WRT your last problem, the shell script executed by xcode, I need to do something similar in Eclipse on Linux and I put the shell command in Properties->C/C++ Build->Settings->Build steps->Post-build steps->Command

I hope that helps.

-Brian

Brian,

Thanks a lot. You rock. That last trick helped me over the hump.

I now have openFrameworks working entirely on my Mac inside of eclipse. Theo/Zach, I plan on testing out my project of a few other machines. If all goes well, I’ll write up a doc and send you guys the accompanying zipped up project.

Thanks for your help guys,
Matt

Cool, glad you got it working!

I haven’t used eclipse for a while on a mac but I just downloaded it and it looks a lot more solid than I remember - I would love to check out the project you have when you’re ready.

I am curious to compare it to Xcode on things like errors, warnings and debugging.

Theo

Hey guys,

So I was able to get OF working on someone else’s computer so I’m pretty comfortable it’ll work for anyone. Where can I send the project? It’s about 50 megs. Is there an FTP server I can upload it to? I’m working on writing up a walkthrough for setting it up.

Matt

We don’t have file-upload / guest ftp account setup yet for the site at the moment - but if you can send it I can upload it to our site and then post a link for people to download. Can you send it over via zshare? - http://www.zshare.net/

I am very curious to check it out.
Be great to have a guide too!

Cheers!
Theo

I actually just posted the project on my server. You can download it here:

http://www.madparker.com/OFTemplate.zip

So, I think this all you need to know to run it:

Create a new C++ project in eclipse.
Then, control click on your project, go to import.
Go to General>File System
Browse to my project you downloaded
Select the check box next to the folder when it appears in the left window
Click Finish
When ever it warns you that you’re about to overwrite a project file, tell it to go ahead and overwrite.
If you created a project that auto generated a class with a “main” function, you should remove that class.

That’s it. Once the project it’s done importing the information, you should be able to build and run the project. It defaults to use the graphics example, but you can replace it with any OF project.

Let me know if you get a chance to give it a try and if you run into any problems. It’s not perfect, but it’s pretty solid. Feel free to alter the project and/or post it on the site.

Matt

madparker – thank you SO much for your zipped project. I’ve attempted to get things working in Eclipse, too – Your project got me that much closer to achieving it. I have successfully got things working.

I’ve uploaded an alternative eclipse project here. I’ve used some of madparker’s settings which I didn’t have before (the shell script that runs after building).

I am using Eclipse Version: 3.3.1.1, and obviously have the Eclipse CTD (C++/C Development Tools) plugin installed. You need to get your Eclipse install working to the point where you can create a Hello World Executable, or MakeFile version.

The differences in my Eclipse OF project are that the executable is aptly named “openFrameworks”, and I’ve taken all the openFrameworks files (audio, graphics, communication, etc), and dropped them into one folder, so don’t have to include 5 individual folders. I’ve also removed all the examples – it gets really messy. You can download the OF demo apps yourself, and copy and paste the appropriate project’s source into the src folder.

In the Project Properties, go into C/C++ Build > Settings. Click “Directories” under the GCC C++ Compiler. Make sure they are all pointing to the correct places in your workspace as it fits your machine. They should look something like: “${workspace_loc:/openFrameworks/src}”.

Also make sure you check the source paths in the GCC Assembler section.

Click the “Build Steps” tab, and point the Post-build steps Command to the appropriate shell script you want to execute after building.

Next, go to the C/C++ Build > Environment, and make sure the PWD and CWD are pointing to the correct places. Obviously replace my home dir with your own.

My last hurdle is getting rtAudio working. Right now, I get the error :

RtAudio: no devices found for compiled audio APIs!

I saw some other posts about this prob. I’ll post my solution as a followup. (if i find one)

cheers!

gabe
http://quilime.com
gdunne@quilime.com

awesome notes -

The differences in my Eclipse OF project are that the executable is aptly named “openFrameworks”, and I’ve taken all the openFrameworks files (audio, graphics, communication, etc), and dropped them into one folder, so don’t have to include 5 individual folders.

just wondering, is the reason for this just to avoid having to add paths or something more problematic with eclipse ? just wanted to know b/c alot of OF code is structured in different folders, so important to know how this related to eclipse. if it’s just because it easier that way - cool ! - but if there is a problem w/ paths, would like to know…

(as a side note - we are trying to unify as much as possible compilers for addons, so important to know about all small differences)

also, one thing you might want to do is rename the zip:

ie instead of openFrameworks.zip

mac_eclipse_gd_0.04_openframeworks.zip

or something, just so that it’s google-able and people can get back to this posting. (and read about what you did, etc). version in the zip name is also crucial.

thanks again for the info &
take care!!
zach

The reason I put all the OF stuff into one folder was simply so I didn’t have to include all the folders in Eclipse individually. I try to keep a minimal amount of includes for the sake of elegance, usability and cleanliness. However, you’re right, this may cause problems down the line for people using it in the future at the current version, so reverted the folder structure and updated the file here! Also, the rtAudio stuff won’t compile in this project, as mentioned. I hopefully will fix that shortly.

http://media.quilime.com/files/src/mac-osx-eclipse-gdunne-openframeworks.0.04.zip

thanks,
gabe

in reference to getting rtAudio working – i simply added this to the rtAudio.h file.

  
  
#ifndef __MACOSX_CORE__  
	#define __MACOSX_CORE__  
#endif  
  

just to be redundant in defining that the app, is in fact, compiling on OSX. Now everything works fine. I’ve re-upped under the same url:

http://media.quilime.com/files/src/cpp/mac-osx-eclipse-gdunne-openframeworks.0.04.zip

opening this thread again…

there is someone who use eclipse with openframeworks and can tell me where to find preRelease v0.06 project for eclipse?
or how to built him?

openframeworks is a pain in the ass for us on eclipse-cdt i noticed. I cant get it to work without including every single folder in the framework. :slight_smile:

I dont know, something like bjam for boost, and how I simply built and installed glfw for Mac and it works flawless.

any suggestions/ideas how ?

I cant get it to work without including every single folder in the framework.

do you mean, include paths like:

  
  
..\..\..\libs\openFrameworks  
..\..\..\libs\openFrameworks\app  
..\..\..\libs\openFrameworks\graphics  
  

if so, what’s the problem with that? that’s how all the other gcc based distributions work, actually, that’s how every IDE works for OF.

granted, if we threw all OF files into one folder, you’d have just one path. but, if we threw all OF files into one folder, it would be alot harder to understand how OF works or is structured.

take care,
zach

Hello!

I just recently discovered OpenFrameworks and I’m only beginning to work with it, but it looks very promising!
First, I want to say THANKS for this thread and the instructions on how to get it working in eclipse on a Mac! Without your help, I would still be trying :wink:

If anyone is interested, I could provide my working eclipse project with the OpenFrameworks version 0.06 (of_preRelease_v0.06_xcode_FAT). I started from madparker’s file (thanks for that shell script! =) ) and changed the include paths to work with the file structure of the new v0.06. I don’t know if I did everything as I should have, but for now it is working. (I’m still getting stuck when I have to include new libraries :-S)

At first I had problems with the data folder, where fonts, images and other things are supposed to be stored. On OS X, the function ofToDataPath() (ofUtils.cpp) changes the path to …/…/…/data/ because it expects the executable to be in an OS X application (.app folder). As eclipse does not create that .app data structure, the data folder was not in the correct location. As a quick workaround I simply disabled the function ofToDataPath() by calling ofDisableDataPath(). How did you solve this problem?

cheers
ghanit