On Thu, Oct 1, 2009 at 9:15 AM, Jérémy Morel <[email protected]> wrote:

> Hi!
> I'm very new to DirectFB, and I wanted to try the simple.c example (
> http://www.directfb.org/docs/DirectFB_Tutorials/simple.html). I tried to
> compile it using gcc, but I got this error :
> /tmp/ccAPaDmn.o: In function `main':
> test1.c:(.text+0x1e): undefined reference to `DirectFBInit'
> test1.c:(.text+0x5f): undefined reference to `DirectFBErrorFatal'
> test1.c:(.text+0x6b): undefined reference to `DirectFBCreate'
> test1.c:(.text+0xac): undefined reference to `DirectFBErrorFatal'
> test1.c:(.text+0x107): undefined reference to `DirectFBErrorFatal'
> test1.c:(.text+0x178): undefined reference to `DirectFBErrorFatal'
> test1.c:(.text+0x1db): undefined reference to `DirectFBErrorFatal'
> test1.c:(.text+0x255): undefined reference to `DirectFBErrorFatal'
> /tmp/ccAPaDmn.o:test1.c:(.text+0x2c8): more undefined references to
> `DirectFBErrorFatal' follow
> collect2: ld returned 1 exit status
>
+--------------------------------------------------------+
What is command line for compiling?   Undefined References means your not
providing the implementation for the declaration.  Or in other words, your
missing the library to link against.

-ldirectfb-1.3 -lfustion-1.3 -ldirect-1.3 -L/usr/lib

(lower case "l" or "L" is for listing the specific library and upper case
"L" is for listing the search path, an upper case "I" or i is for the
include search paths, and in my case I'm using direct fb 1.3 so your
libraries might differ)
+--------------------------------------------------------+

>
> I thought it may be because this was not a c file but rather a c++ file and
> switched to g++. This worked a little better, but I still got these errors :
> g++ -I /usr/include/directfb test1.c
> test1.c: In function ‘int main(int, char**)’:
> test1.c:26: error: invalid conversion from ‘int’ to
> ‘DFBSurfaceCapabilities’
> test1.c:34: error: invalid conversion from ‘int’ to ‘DFBSurfaceFlipFlags’
> make: *** [test.o] Error 1
>
> In the code, line 26 is the following : dsc.caps  = DSCAPS_PRIMARY |
> DSCAPS_FLIPPING;
>
> I took a look at directfb.h and found (I guess) what the error is due to.
> DFBSurfaceCapabilities is an enum, and while DSCAPS_PRIMARY and
> DSCAPS_FLIPPING are part of the enum, DSCAPS_PRIMARY | DSCAPS_FLIPPING
> isn't. This may have been fixed in DirectFB > 1.0, but this is the version
> I'm using (this is the package available in debian stable).
>
> If it has been corrected, could someone add a comment to the file saying
> that you need DirectFB > x.x  in order to compile simple.c ?
> And of course, if that is not the issue, could you tell me what it is 
> ?<http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users>


+--------------------------------------------------------+
Type cast the int to the enum...
i.e. dsc.caps  = (int)DSCAPS_PRIMARY | (int)DSCAPS_FLIPPING
Does that solve it?
+--------------------------------------------------------+
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to