maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Liblocation problems (https://talk.maemo.org/showthread.php?t=60786)

Pedrolito 2010-08-21 09:50

Liblocation problems
 
Hi there i have some problems to use the following libraries

#include <location/location-gps-device.h>
#include <location/location-location-gpsd-control.h>

Indeed, when i include those 2 on my project a lot of errors came on the compilation because the compiler can't find .h files like gtk, glib, pango, cairo etc...
So i browse my include file in the SDK and found the correct files... SO i add to my .pro INCLUDEPATH += (correct path) and some errors disapeared but it still missing some files like gdkconfig.h , glibconfig.h that doesn't appear at all in the include files...

So i am asking to find some help because that seems strange to me that we can't use the liblocation.

I am working with Windows 7 and Qt Creator so i code in C++...

Additionnal questions:
I have seen many examples code in C and python to use the camera or the gps on the N900 but it still can't be possible to use this features with the cpp libraries no?

Thanks and I hope somebody had the same problem and had solve it...:rolleyes:

Diph 2010-08-21 10:21

Re: Liblocation problems
 
Maybe something like this? I'm not sure if you need all of them...

Code:

CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 liblocation
LIBS += -llocation


Pedrolito 2010-08-23 09:42

Re: Liblocation problems
 
well that don't seem to work :-(

I have tried the example from : http://wiki.forum.nokia.com/index.ph...on_Example.zip

and there is still some problems of compilation... well it is not a problem of finding .h files but it is something like it doesn't know GLIB_VAR types like guint... i hope that mean something to somebody...

nicolai 2010-08-23 09:53

Re: Liblocation problems
 
Please post the compiler error message, otherwise we
can only guess what is the failure.
If the compiler complains about missing or undefined types, you
may have forgotten some includes, like #include <glib.h> for example.

regards
Nicolai

Pedrolito 2010-08-23 10:41

Re: Liblocation problems
 
Code:

from locationinfowidget.cpp:1:
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: ISO C++ forbids declaration of '__declspec' with no type
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: warning: '__declspec' initialized and declared 'extern'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: 'dllimport' was not declared in this scope
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: expected ',' or ';' before 'const'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:423: error: ISO C++ forbids declaration of '__declspec' with no type
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:423: warning: '__declspec' initialized and declared 'extern'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:423: error: redefinition of 'int __declspec'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: 'int __declspec' previously defined here
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:423: error: 'dllimport' was not declared in this scope
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:424: error: ISO C++ forbids declaration of '__declspec' with no type
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:424: warning: '__declspec' initialized and declared 'extern'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:424: error: redefinition of 'int __declspec'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: 'int __declspec' previously defined here
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:424: error: 'dllimport' was not declared in this scope
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:425: error: ISO C++ forbids declaration of '__declspec' with no type
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:425: warning: '__declspec' initialized and declared 'extern'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:425: error: redefinition of 'int __declspec'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: 'int __declspec' previously defined here
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:425: error: 'dllimport' was not declared in this scope
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:426: error: ISO C++ forbids declaration of '__declspec' with no type
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:426: warning: '__declspec' initialized and declared 'extern'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:426: error: redefinition of 'int __declspec'
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:422: error: 'int __declspec' previously defined here
C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gutils.h:426: error: 'dllimport' was not declared in this scope
In file included from C:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/include/glib-2.0/glib/gasyncqueue.h:34,

there are errors like these ones... but there is too many lines to put the whole thing...

and here is the .pro file given by the example :

Code:

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 liblocation hildon-1

HEADERS += locationinfowidget.h
SOURCES += locationinfowidget.cpp \
    main.cpp

thanks

nicolai 2010-08-23 11:13

Re: Liblocation problems
 
I am not sure but can you try this,
change the first line in locationinfowidget.cpp from:
#include <hildon/hildon-banner.h>
to
extern "C" {
#include <hildon/hildon-banner.h>
}

danielwilms 2010-08-23 11:46

Re: Liblocation problems
 
Hi,

please check out this example, to see how it should work. The "extern C" mentioned by nicolai should do the trick.

But have you seen the QtMobility APIs for the location? This should be much easier!

Daniel

Pedrolito 2010-08-23 11:58

Re: Liblocation problems
 
@nicolai still doesn't work...

@danielwilms
This is the example that i am trying to make work...

And i will try to use the QtMobility APIs but i find really strange that i can't compile an official example...

nicolai 2010-08-23 12:01

Re: Liblocation problems
 
Quote:

Originally Posted by Pedrolito (Post 795743)
@nicolai still doesn't work...

You get the same error message?

Pedrolito 2010-08-23 12:22

Re: Liblocation problems
 
exactly the same...


All times are GMT. The time now is 19:26.

vBulletin® Version 3.8.8