This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Troubles coding Qt apps

Tags: None
(comma "," separated)
NOX
Registered Member
Posts
6
Karma
0
OS

Troubles coding Qt apps

Sun May 09, 2010 7:55 pm
Hello everyone!
I'm new with Qt, I've started to learn it a couple of days ago and after getting to practice got a problem.

Having written a simple application (just for testing), I've compiled it, and:

Code: Select all
#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
        QApplication app(argc, argv);
        QLabel *label = new QLabel("Hello Qt!");
        label->show();
        return app.exec();
}

nox@striker:~/temp$ qmake -project
nox@striker:~/temp$ qmake temp.pro
nox@striker:~/temp$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -Icwp-1.0.1 -I. -I. -o hello.o hello.cpp
In file included from /usr/include/qt4/QtCore/qbytearray.h:48,
from /usr/include/qt4/QtCore/qstring.h:46,
from /usr/include/qt4/QtCore/qobject.h:48,
from /usr/include/qt4/QtCore/qcoreapplication.h:45,
from /usr/include/qt4/QtGui/qapplication.h:45,
from /usr/include/qt4/QtGui/QApplication:1,
from hello.cpp:1:
/usr/include/string.h:546: error: ‘__locale_t’ has not been declared
/usr/include/string.h:547: error: nonnull argument references non-pointer operand (argument 1, operand 3)
/usr/include/string.h:550: error: ‘__locale_t’ has not been declared
/usr/include/string.h:551: error: nonnull argument references non-pointer operand (argument 1, operand 4)
make: *** [hello.o] Error 1


It will be a great thing, if anyone could help.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Troubles coding Qt apps

Mon May 10, 2010 8:44 am
It looks like you are missing some standard C++ development packages. You may also wish to ask in #qt on Freenode.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
NOX
Registered Member
Posts
6
Karma
0
OS

Re: Troubles coding Qt apps

Mon May 10, 2010 10:40 am
oh thanks a lot. i think it's g++-multilib that I have to install. =)
NOX
Registered Member
Posts
6
Karma
0
OS

Re: Troubles coding Qt apps

Mon May 17, 2010 8:34 am
well, i've installed all the stuff i could find in my repository, but i still got the same problem. could anyone tell me, what do i need in order to build a qt application?
that'll be a great help =)

oh, and i've got:
-qmake v2.01a
-qt v4.6.2
-g++ v4.4.4
-make v3.81
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Troubles coding Qt apps

Mon May 17, 2010 10:18 am
Just curious, why
Code: Select all
qmake temp.pro

instead of
Code: Select all
qmake

?

Which distro do you use? Some have a (meta)package called build-essential or something similar to install most of the necessary packages.


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
NOX
Registered Member
Posts
6
Karma
0
OS

Re: Troubles coding Qt apps

Mon May 17, 2010 2:12 pm
Just curious, why ...

I don't know =)

I use Debian unstable, and build-essentials are already installed.

btw, i used string.h from another distro (ubuntu 10.04), result was the same.
i thought there could be some troubles with locales, but everything seems to be ok.

and yeah, i've got the same problem when building wine-1.1.32, looks like i've somehow broken some kind of lib :(
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Troubles coding Qt apps

Tue May 18, 2010 5:42 am
Please check for the presence of "xlocale.h"


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
NOX
Registered Member
Posts
6
Karma
0
OS

Re: Troubles coding Qt apps

Tue May 18, 2010 1:56 pm
It's present. And "locale.h" too.
NOX
Registered Member
Posts
6
Karma
0
OS

Re: Troubles coding Qt apps  Topic is solved

Tue May 18, 2010 2:41 pm
Well i solved this problem, don't know if this was right solution

If anyone wants to know:
here's a part of "string.h" where i got problems:

Code: Select all
#ifdef  __USE_GNU
/* Again versions of a few functions which use the given locale instead
   of the global one.  */                                             
extern int strcasecmp_l (__const char *__s1, __const char *__s2,       
                         __locale_t __loc)                             
     __THROW __attribute_pure__ __nonnull ((1, 2, 3));                 

extern int strncasecmp_l (__const char *__s1, __const char *__s2,
                          size_t __n, __locale_t __loc)         
     __THROW __attribute_pure__ __nonnull ((1, 2, 4));           
#endif


So i just added

Code: Select all
#ifdef  __USE_GNU
#include <xlocale.h>


and everything works! :)
Big thanks to everybody who helped me!


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell