adding xml addon to project

hi

not sure this is the best place to ask this, but I already asked in begginers and did not clarify me at all

i have OF v0.6 FAT version with the addons. I am trying to add XML addon to my working project (linux Codeblocks). I believe i need to select “workspace”, then go to Project > Build Options > and here i need to add the paths to the source and so on. But I dont fully understand what I have to add where.

i know i could get the xml example and start coding from there, but since i have already been coding for two days and i am using OSC addon as well, i guess i better get to understand this properly.

could anyone explain please, for example, what to add in “link libraries” list of paths, and also “search directories” list of paths for both compiler and linker.

I have added in all of them both folders “…/…/…/addons/ofxXmlSettings/libs” and “…/…/…/addons/ofxXmlSettings/src” but still get this error

testApp.cpp|24|undefined reference to `ofxXmlSettings::loadFile(std::basic_string<char, std::char_traits, std::allocator >)’|

…and so on… with all XML. functions.

i forgot to say i dont think i am doing an error in my programming. is a very simple piece of code

thanks!

enrike

hi

in linux there’s a simple way of adding addons by using the python script that you can find in scripts/ofProjectManager. once you install it, you can do from the command line:

ofProject create projectName

to create a project, or:

ofProject add projectName ofxXmlSettings

to add an addon from the addons folder with a well formatted install.xml file in it (all the official ones should work)

To add it manually it should be a matter of adding all the files of the addon to your project from: project>add files recursively … and selecting the directory where tha addon is. be careful not to add the example files inside the addon or you will end with a project with 2 testApps and to mains and it will fail when compiling.

interesting, so if i want to create a project that will deal with say three different addons i would have to do something like

ofProject add projectName ofxXmlSettings ofxOsc ofxVectorMath

and if, like me currently, you find half way though your project that you need to use a new addon. You would either start a project from scratch with ofProyect script and add all your source files manually, or add manually to your old project the addon source files.

is this correct?

just found it myself … the right way to do it would be

$ ofProject create projectName
$ ofProject add projectName ofxOsc
$ ofProject add projectName ofxXmlSettings
$ ofProject add projectName ofxVectorMath
and so on…

then in my case i replaced with my own files the testApp.h, testApp.cpp and main.cpp, and finally added the extra files with other classes I had already coded.

Couple of things :

it would be great to have a readme.txt with instructions like this next to the script installer in the scripts folder.

it would also good to provide feedback to the user that the process of project creation or addon addition has been sucessfully end. In my case I got this warning when both creating and adding:

ofProject add oscVideoServer ofxOsc
/usr/lib/python2.6/sets.py:85: DeprecationWarning: functions overriding warnings.showwarning() must support the ‘line’ argument
stacklevel=2)
/var/lib/python-support/python2.6/amara/bindery.py:4: DeprecationWarning: the sets module is deprecated
import sets

for a second this made me confused because I thought that the script did not actually worked. Then I realise that it is just a warning. It did not help the fact that (to my knowledge) i did not know where the files where actually created. I found them after searching in my folders that it is actually a directory called MyApps at the same level as AddOnsExamples and Examples. This should go as well in any future documentation.

but maybe there is documentation and it is just me that did not find it? I only found that the ofProject prints the usage if you pass no arguments.

I am thinking on students or me after a sleepless night :wink: I would be happy to write the readme file and (try to insert) the feedback in the python scripts.

thanks!!

Sounds like you haven’t added the addon files to the project yet. As arturo said, right click the project and then select “add files” or “add files recursively”. Once you’ve imported them you may want to organise the addon files in virtual folders like the way there are done in the addon examples.

i think i have added them properly. the new project compiles now and everything works fine asd far as I can see. Both xml and osc addons work now.

about the feedback in the python script it would be just a matter of adding a line a the end of saveProject() at projectManager.py printing “done with project Blah” or more complex “succesfully added ofxOsc addOn to project Blah”.

thanks! now i have a much clearer idea of how to work with addons

yes, sure, the warnings are because the latest ubuntu is using python 2.6, but then it works.

there’s already documentation in the readme.txt in the root of the openframeworks package. although perhaps it’s a good idea to have them separated.

oops… i am back home working with my desktop and i can see that the instructions popup when running the installer. Also I found the part of the general docs where it talks about the project manager. I must wait and tripple check before posting to the forum :slight_smile:

i am going to watch it now. many thanks for your help!

hi,

i got the message

couldnt find -lofxXmlSettings

i tried the variant with “ofProject add projectname ofxXmlSettings”

i’ve also tried it manually but it didn’t work.

i am sure it’s a littl trick behind it. Because the ofxXmlExample is working without any problem.

Am i right, that there is no *.a or *.so file ? I just found the cpp / h files in the lib directory.

thank you very much

yafes

how do you get this message:

couldnt find -lofxXmlSettings

with codeblocks? makefiles?

also what errors do you have with ofProject?

oh sorry,

this error occures in codeblocks. When i use the installer, i get two warnings:

/usr/lib/python2.6/sets.py:85: DeprecationWarning: functions overriding warnings.showwarning() must support the ‘line’ argument
stacklevel=2)
/usr/lib/pymodules/python2.6/amara/bindery.py:4: DeprecationWarning: the sets module is deprecated
import sets

But after applying this installer, i see that under “search directories”

…/…/…/addons/ofxXmlSettings/src
…/…/…/addons/ofxXmlSettings/libs

are added.

hummm…

Here is my build-log:
Compiling: src/main.cpp
Linking console executable: bin/advancedEventsExample_debug
/usr/bin/ld: cannot find -lofxXmlSettings
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
1 errors, 32 warnings

The build-Log from the xml-example
Compiling: src/main.cpp
Linking console executable: bin/advancedEventsExample_debug
/usr/bin/ld: cannot find -lofxXmlSettings
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
1 errors, 32 warnings

I have found the problem:

i’ve had added ofxXmlSettings to the linkerSettings under “Build Options”. Therefore he was searching for a library which was not existing…

thanks everyone :slight_smile: