Re: Hello World

David Haller <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
Hallo,

Am Son, 07 Jun 2009, Sascha 'saigkill' Manns schrieb:
>Den Fehler vergessen:
>> Sagt das jemandem was?
>sascha@linux-eh47:~> gcc -L/usr/lib64/ -IQtGui -I/usr/include/QtGui 
>hello-qt.cpp -o testapp
>/tmp/ccBSgZ6V.o: In function `main':
>hello-qt.cpp:(.text+0x24): undefined reference to 
>`QApplication::QApplication(int&, char**, int)'

Du mußt auch gegen QtCore (qt-mt/qt bei Qt3 und älter) linken und

[..]
>/tmp/ccBSgZ6V.o:(.eh_frame+0x13): undefined reference to 
>`__gxx_personality_v0'
>collect2: ld returned 1 exit status

g++ verwenden.

    g++ -I/usr/include/QtGui -lQtGui -lQtCore hello.cpp -o hello

-L/usr/lib/ (bzw. -L/usr/lib64) ist default.

oder besser dir per pkg-config die richtigen Flags holen:

    make CXXFLAGS="$CXXFLAGS $(pkg-config --cflags --libs QtGui)"  hello

explizit:

    g++ $CXXFLAGS $(pkg-config --cflags --libs QtGui) hello.cpp -o hello

HTH,
-dnh

-- 
Diese Signatur ist vorübergehend nicht erreichbar.
Versuchen Sie es später noch einmal oder hinterlassen
Sie eine Nachricht vor dem Signaturtrenner. Piep.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.