C++ Learning Community Forum
September 09, 2010, 08:22:33 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hello. Smiley
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: QT tutorial example not compiling  (Read 1097 times)
ih8censorship
Megalomaniac!!!
Administrator
C++ guru
*****
Posts: 1241



View Profile
« on: July 23, 2007, 02:14:36 AM »

I am looking at the tutorial at http://doc.trolltech.com/3.3/tutorial1-01.html and when i try to compile heres what happens:
Quote
klyons@nowhere:~/qttest> qmake -project
klyons@nowhere:~/qttest> qmake
klyons@nowhere:~/qttest> 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/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:19: error: ‘class QApplication’ has no member named ‘setMainWidget’
make: *** [main.o] Error 1
klyons@nowhere:~/qttest>   
so i looked at the QApplication page at http://doc.trolltech.com/3.3/qapplication.html and saw that it had a setMainWidget member. The only thing i can think of is maybe im using a version that is incompatible with that tutorial- i clicked "About QT" in several QT programs and i got versions ranging from like 3.3.7 to 4.x, im not sure which one im trying to compile with anyone have an idea here Huh
Logged

PC==perfect_companion

Knowledge cannot come packaged and predigested; it must be chewed over carefully before swallowed.

What have you tried?
Odo
N00b!!1
*
Posts: 4


View Profile
« Reply #1 on: August 26, 2009, 07:48:31 PM »

use this one instead

http://doc.trolltech.com/4.5/tutorials-addressbook-part1.html
Logged
kccc
I think we have an answer to C-Man's question in his title.
Geek
*****
Posts: 147


View Profile
« Reply #2 on: August 27, 2009, 01:56:27 AM »

I believe you have to use QApplication::setActiveWindow instead of QApplication::setMainWindow.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!