mixing frameworks ; #error gl.h included before glee.h

Hi everyone !

I want to design an interactive system using some multitouch devices. So I have a multiotuch device and its SDK and i want to integrate OF to work with it.

Both frameworks use opengl so I shouldnt have any problem to call ofcircle (for example). The problem seems to be that that sdk calls glew and glee while OF calls gl.

I ve looked for some info about that and it seems that if you include these files you must not include gl.h

As the sdk is not opensource and I cant modify the code, what changes should I do to OF classes in order to compile ?

Thanks a lot !

hmm - you may have to hack ofContstants

we use GLEE, which means you cannot include opengl before ofContstants (via ofMain). ie, to use an opengl h file, you’d write:

#include “ofMain.h”
#include “myGLhFile.h”

the problem is (as I understand) your opengl project is also using glew? that will cause major conflicts since it’s kind of the same style. if it’s not using glew, then just try it as above. if it is, you could try first commenting out our glee include call and include your stuff first – if it’s doing extension loading stuff, it might work.

hope that helps!
zac

Hi zac, thx for replying :slight_smile:

Yes, it seems that this sdk uses glew.

The order of the includes is the order you said, first ofmain and then my gl/sdl include.

So , I ve tried to comment the glew include (if target_linux) in ofconstants.h , but the error remains.

From my point of view, it doesn’t really matter, following the correct order of inclusions, if I have that glew include uncommented, the problem is that it might be any other OF file which includes gl

the compiler complains : " #error gl.h included before glew.h" if my sdk calls glew there is something in OF that calls gl first.

I meant, try to comment out GLee.h in ofConstants.h - then you should be able to do

#include “myGlthingThatHasGLEW.”
#include “ofMain.h”

I’m pretty sure you will have some errors in OF, where we use extensions (Since glee is no longer there). it’s not a huge part of the code tho – and you’ll just have to write to to work with glfw.

sorry it’s not easier, but since you don’t have the sourcecode for what you are trying to mix, there’s no way for you to remove glew… you’ll have to try to get OF glee-less.

take care,
zach

Okay, I ve taken a look inside all OF classes and there is not any gl include. But, there are some includes of glut.h which internally includes gl . . .

It represents that ofmain calls glut, glut calls gl, and then the sdk i have calls glee and/or glew (i don’t know exactly) so there is a conflict.

is there any way to solve/hack this problem?

update: I havent seen your reply , ok , lets try :stuck_out_tongue:

Tahnks zarc! it has solved the problem. But as you have said now i have some OF errors related to glee.

Luckily these is only one error, the non declaration of GL_ARB_texture_rectangle used in ofTexture.

I am not used to work with glee so i dont know what exactly it does … the fast option should be comment or erase glee_arb_texture_rectangle and use always gl_texture_2d. But then what things i wont be able to do with of ? I mean, why we use gl_rexture_rectangle_arb instead of gl_texture_2d ?

Perhaps i dont need it . .

you can comment it out w/ out any problems, or see how it’s done with glew – ie, glew must have a way to use that extension.

glad it’s almost there !

take care,
zach

I ve commented and also tried to use GL_ARB_… instead of GLEW_ ,… but now i’m receiving a really strange complaint from the compiler:

“/usr/lib/libavformat.so.52||undefined reference to `ff_mpeg4audio_channels’|”
and 18 more complaints of this kind

is wreid because I can execute OF with that library and also I can run the Multitouch examples . .

I think maybe this is not OF problem … but do you have any suggestion ? I’m completely stuck :frowning:

you are on linux? did you bring OF into your multitouch library, or your library into OF ?

not entirely sure, but undefined reference means you are not properly linking against a library, in this case ff_mpeg? since both compile and run as you say, maybe you are missing some linkage from OF that had before ?

you can check your linkages from cb via the build settings, you’ll see a list of libraries, ie,

-l
blah.a

check to see that this matches a vanilla OF app.

alternatively, you might have some linking conflict if both projects have different versions of some library in them. linker could get confused, and not properly make the connections.

hope that helps!
zach

hey oriol

didn’t realise yesterday but in 005 the ffmpeg libraries are inside the same oF distribution and fobs has dependencies with that exact version, so the problem can be that fobs is using one version of ffmpeg and your multitouch sdk a different one.

If that’s the problem there’s no simple solution, only recompiling fobs which is really hard as now it’s incompatible with last ffmpeg versions.

Hi ,

I know these problems aren’t related only with OF but I appreciate any help very much.

I ve taken a look to the sdk’s faq : http://www.multitouch.fi/cornerstone/faq
and it seems I can install manually the ffmpeg.

So the idea I have is to install these old version of ffmpeg, make the sdk run with it, and then ( I dont know exactly how ) use OF 006 with that version of ffmpeg. Or maybe the 005 version … but then I’ll need to link the libraries :S . .

So i have donwloaded the ffmpeg from that svn , but now when I try to install it I get worrying messages
such as:
“libavcodec/imgresample.c:522: error: conflicting types for ‘sws_getContext’”
I also get a lot of warnings about deprecated methods :frowning:

any idea ? what should I do ?