freeImage.a Processing error?

Hello forum, i am trying to run openFrameworks from the source code and i have almost got it,… but not quite. all the source code compiles fine but when linking in the freeimages library i get a ton of multiple definitions errors:

cd /Users/stull/Documents/C++progs/serialtest/usr/bin/gcc-4.0 -bundle -arch ppc libs/freeimage/lib/freeimage.a -Wl,-all_load -mmacosx-version-min=10.4 -Wl,-twolevel_namespace -Wl,-twolevel_namespace_hints -Wl,-undefined -Wl,dynamic_lookup -Wl,-multiply_defined -Wl,suppress -isysroot /Developer/SDKs/MacOSX10.4u.sdk -o
/Users/stull/Documents/C++progs/serialtest/build/serialtest.build/Debug/serialtest.build/Objects-normal/ppc/freeimage.ab
/usr/bin/ld: multiple definitions of symbol _FreeImage_Close
libs/freeimage/lib/freeimage.a(Plugin.o-ppc) definition of _FreeImage_Close in section (__TEXT,__text)
libs/freeimage/lib/freeimage.a(Plugin.o) definition of _FreeImage_Close in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _FreeImage_Close.eh
/////////ect.\\\
collect2: ld returned 1 exit status

when i don’t link the freeimages in it builds fine and i can run most of the test exampleApps without problem (except for the ones dealing with images) any ideas?

sorry background is:
im running it out of xcode (which im just starting to use, might be the problem right there? don’t have my link setting configured right? ) adding in the files and frameworks with ADD >> relative path >> copy to project as needed ect. no other files linked in, basically a copy of the openframework testApp project but built from the source. i also got the rtAudio working after reading the post by getting rid of all the .cpp files, so thats not giving me any problems.

By the way! this is a great project, opening up c++ is well worth it especially for computer vision and graphic apps. the serial library is a very good add also it is the premier language of the physical to the computeral. if your planning on adding to it, functions that return the number of bytes in the buffer and also a serial flush are really handy when doing a ordered protocol.
thanks again!
cheers,
johnHenry

Hi John,

Thanks for the detailed description of your problem!
Can I ask you a couple of questions first, as I have not seen this issue before.

What version of xcode are you running?

What version of OS X are you on?

What model mac is it?

Are you putting the xcode project together yourself or just trying to compile the examples? From your description it sounds like you are might be making your own project from scratch .

Does it do this if you select Build->Clean All Targets - and then try and compile?

Thanks for the thoughts on serial - both of those are good suggestions!

theo

yeah sure i am building out the project from scratch using the carbon project build option. i am running a g4 powerbook with the 1.2 powerPC cpu and 10.4.1 as my os, my xcode is 2.4.1 i think the latest version? yeah it is a bit weird it looks like it is ignoring a ifdef somewhere and recursively calling a .h file because the list repeats and is long! where i can’t tell? i clean all the targets and they recompile fine its just when the freeImage lib is linked in at the end that i get it? When i compile and run the examples you guys put together everything runs fine though.
thanks again,

Hi John,

Building the project from scratch is a bit of a pain (we aim to make a empty project template for xcode).

It is generally a lot easier just to duplicate an example folder and then modify the code in that - this is what we usually recommend.

But incase you just feel like doing it from scratch there are a couple things to check:

  1. Check that you are building against the same SDK 10.4 (universal).

  2. Go through all the settings in Project->Edit Project Settings->Build

Collection: ‘All Settings’

Check that the Architectures are specified correctly. Should be either ppc or i386
or both for a universal app.

Then see if you can find any other difference between an example projects settings and the ones you have (they’ll probably be quite a few).

  1. Frameworks
    Check that you have the same frameworks included in your project as we have in the example projects. These should be linked Absolutely (as they are always in the same place on peoples drives).

That should be it - hopefully one of those things will sort it out for you.
Cheers!
Theo

thanks i got it! it runs fine if i compile it as a release and not a debug build? i went through the build settings and only had to add

-Wall -D__MACOSX_CORE__ -lpthread

to the build arguments but it still only likes the release build? any thought on why?
Im ok with it working though, i just find its good to know the why’s because i will invariably add in some code that will screw everything up and its good to have a starting point to work back from.
thanks one more time!

The Release settings are different to the Debug settings so what ever you add that makes it work in Release make sure it is in there too for Debug.

If you do -

Configuration - All Configurations and
Collection:All Settings -

it will say “” in grey whenever there is a difference between the Debug and Release Settings. It is an easy way to see what the differences are.

In openFrameworks the only difference we have is that in Debug we have the native architecture and Release we have ppc and i386

This way when you compile in Debug you’re only compiling for your cpu which reduces compile times a lot especially for older computers.

Also you can remove the -Wall flag which just gives you an unnecessary amount of warnings.