from XP to Ubuntu

hi

i am trying to compile a OF application I have been developing under XP with codeblocks. I thought I could just open the .cdb file and press F9 to compile, but it does not like it. I noticed that there must be a makefile. I am not sure how this is done, if i need to change the properties of the project under codeblocks or i need to manually edit it to point to the libraries.

I am using Ubuntu 9.04-desktop-i386, the very latest svn codeblocks version. and of_preRelease_v0.06_linux_cb_FAT. This is the compilation error i get :

||=== myExample, release ===|
/home/r2d2/ixi/of/slicer/src/BgDisplay.h|4|error: ofMain.h: No such file or directory|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp||In member function ‘void BgDisplay::draw()’:|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|42|error: ‘ofEnableAlphaBlending’ was not declared in this scope|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|43|error: ‘ofSetColor’ was not declared in this scope|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|44|error: ‘ofRect’ was not declared in this scope|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|45|error: ‘ofDisableAlphaBlending’ was not declared in this scope|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|48|error: ‘ofNoFill’ was not declared in this scope|
/home/r2d2/ixi/of/slicer/src/BgDisplay.cpp|51|error: ‘ofFill’ was not declared in this scope|
||=== Build finished: 7 errors, 0 warnings ===|

I dont know so much about C++ compilation process yet so any help will be welcome
thanks!

oopps! just realised that it does not compile even the emptyExample, i think i am missing something. this is the error again :

/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/openFrameworks/video/ofUCUtils.cpp|19|warning: avformat.h: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/openFrameworks/video/ofUCUtils.cpp|20|warning: swscale.h: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/openFrameworks/video/ofUCUtils.cpp||In member function ‘void ofUCUtils::set_format(int, int)’:|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/openFrameworks/video/ofUCUtils.cpp|303|error: invalid conversion from ‘int’ to ‘PixelFormat’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/openFrameworks/video/ofUCUtils.cpp|303|error: initializing argument 3 of ‘SwsContext* sws_getContext(int, int, PixelFormat, int, int, PixelFormat, int, SwsFilter*, SwsFilter*, double*)’|
||=== Build finished: 2 errors, 2 warnings ===|

i installed OF and codeblocks with the script that comes with the OF distro.

enrike

hi enrike,

Although codeblocks will open the windows project files it won’t compile as libraries used in both platforms are different.

The best way to port an application is to get a linux example and substitute it’s src folder with your’s. if you have more files than testApp.h .cpp and main.cpp you’ll need to add them manually to the project from project > add files

thats what i thought, it would have been nice to have a xplatform file, but thats not too bad. thanks

adding the files manually worked fine. I also had to fix ofUCUtils.cpp as described here
http://forum.openframeworks.cc/t/upgraded-to-ubuntu-9-and-now-can’t-compile/1928/7

but now i get this error when compiling
ld cannot find -lfmodex

I modified in
Project > Build Options > Linker Settings
and the fmodex entry to point to …/…/…/libs/fmodex/lib/libfmodex-4.22.00.so included with OF and now it compiles fine. However when CodeBlocks runs the example I get this printed in the console :

/emptyExample/bin/emptyExample_debug: error while loading shared libraries: …/…/…/libs/fmodex/lib/libfmodex-4.22.00.so: cannot open shared object file: No such file or directory

Process returned 32512 (0x7F00) execution time : 0.000 s
Press ENTER to continue.

And this is the build log in codeblocks

Checking for existence: /home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/emptyExample/bin/emptyExample_debug
Executing: xterm -T emptyExample -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/fmodex/lib:/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/unicap/lib:/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/libs/poco/lib /home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/emptyExample/bin/emptyExample_debug (in /home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/emptyExample/bin)

hi

have you compressed the package to zip or moved it to a usb stick forrmatted with fat32 or something similar? in linux, libraries usually have some soft links that are not supported in most files systems or compression formats. it seems like you’ve lost those. try downloading the original package again and copying your project there.

no. i just downloaded, uncompressed the file again and tried to compile an example getting the same error

can you post the contents of libs/fmodex and export/libs

it should be:

libfmodex-4.22.00.so
libfmodexp-4.22.00.so
libfmodexp.so
libfmodex.so

if you don’t have the files without the version numbers, that’s the problem, but they are in the original package. this are soft links something similar to windows shorcuts. if they are not there can you try renaming the ones with the version number, both in libs and export.

of_preRelease_v0.06_linux_cb_FAT_old/libs/fmodex/lib$ ls
libfmodex-4.22.00.so libfmodexp-4.22.00.so

/of_preRelease_v0.06_linux_cb_FAT_old/export/libs$ ls
libfmodex-4.22.00.so libfmodexp-4.22.00.so

looks like the libfmodexp.so and libfmodex.so are missing …

don’t know why you don’t have them, this should solve it:

in both libs/fmodex and export/libs:

  
ln -s libfmodex-4.22.00.so libfmodex.so  
ln -s libfmodexp-4.22.00.so libfmodexp.so  

looks like at some point (as you figured out) i have copied the files and the soft links were gone. now it is working.

thanks! and sorry for stupid questions. it is difficult when one starts learning a new tool to see if the error is comming from a programming errro or something missing in the OS, etc…