LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-06-2010, 02:31 PM   #1
blackcore
LQ Newbie
 
Registered: May 2010
Posts: 10

Rep: Reputation: 0
Unhappy Compiling Qt4.6 application


I installed Qt4.6.2 on ubuntu-karmic by building the sources. now am trying to compile my own application using the make command and i get the error:
root@vini-desktop:~/Desktop/newwx/Qt/Qt# qmake-qt4 -project
root@vini-desktop:~/Desktop/newwx/Qt/Qt# qmake
root@vini-desktop:~/Desktop/newwx/Qt/Qt# make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp:1:24: error: QApplication: No such file or directory
main.cpp:2:23: error: QPushButton: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6: error: ‘QApplication’ was not declared in this scope
main.cpp:6: error: expected ‘;’ before ‘app’
main.cpp:8: error: ‘QPushButton’ was not declared in this scope
main.cpp:8: error: expected ‘;’ before ‘hello’
main.cpp:9: error: ‘hello’ was not declared in this scope
main.cpp:12: error: ‘app’ was not declared in this scope
main.cpp: At global scope:
main.cpp:4: warning: unused parameter ‘argc’
main.cpp:4: warning: unused parameter ‘argv’
make: *** [main.o] Error 1

Here is the simple code for the hello world qt program am trying to compile
Code:
#include <QApplication>
#include <QPushButton>

int main (int argc, char *argv[])
{
        QApplication app(argc, argv);

        QPushButton hello ("Hello world!");
        hello.resize (100, 30);

        hello.show();
        return app.exec();
}
why doesn't it find the libraries? how can i solve this?

Last edited by blackcore; 06-06-2010 at 02:36 PM. Reason: forgot code tags
 
Old 06-06-2010, 02:54 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by blackcore View Post
...
why doesn't it find the libraries? how can i solve this?
Have ever thought about installing the needed development libraries ?
 
Old 06-06-2010, 03:20 PM   #3
blackcore
LQ Newbie
 
Registered: May 2010
Posts: 10

Original Poster
Rep: Reputation: 0
i believe i have all the libraries i need.my problem is most likely arising from path differences.Qt was installed in
Code:
 Usr/local/Trolltech/Qt-4.6.2
but the compiler seems to be looking for
Code:
 usr/include/qt4
 
Old 06-06-2010, 03:47 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by blackcore View Post
i believe i have all the libraries i need.my problem is most likely arising from path differences.Qt was installed in
Code:
 Usr/local/Trolltech/Qt-4.6.2
but the compiler seems to be looking for
Code:
 usr/include/qt4
I think these both paths are wrong for various reasons -lack of leading '/', capital 'U'.

Your compilation command line already has a number of '-I...' options, so why won't you add/fix them as needed ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error when compiling app against Qt4 Doug Hutcheson Linux - Software 6 12-16-2009 11:59 PM
starting qt4 - compiling problem divukman Programming 1 07-14-2007 11:25 PM
kubuntu: problem building QT4 application eantoranz Ubuntu 1 01-23-2006 11:39 AM
Compiling qt4 apps for non-qt4 linux, win, mac birdseye Programming 4 10-31-2005 04:45 AM
Application Compiling Daxziz Linux - General 3 02-20-2002 03:21 AM


All times are GMT -5. The time now is 05:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration