4chan archive /g/ (index)
2013-03-04 09:12 32005424 Anonymous (qt-logo[1].jpg 400x400 15kB)
Is anyone familiar with Qt? I'm having a hell of a problem for this assignment due tomorrow. Fucking compile errors.

1 min later 32005457 Anonymous
This is the error I get. [CODE] qmake-qt4 -project qmake-qt4 file.pro make all g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o Button.o Button.cpp Button.cpp:3:21: error: button.h: No such file or directory In file included from /usr/include/QtCore/qdebug.h:54, from /usr/include/QtCore/QtCore:7, from /usr/include/QtGui/QtGui:3, from Button.cpp:1: /usr/include/QtCore/qcontiguouscach e.h:54: error: expected constructor, destructor, or type conversion before 'typedef' Button.cpp:5: error: 'Button' has not been declared Button.cpp:5: error: ISO C++ forbids declaration of 'Button' with no type Button.cpp: In function 'int Button(const QString&, QWidget*)': Button.cpp:6: error: only constructors take base initializers Button.cpp:8: error: 'setSizePolicy' was not declared in this scope Button.cpp:9: error: 'setText' was not declared in this scope Button.cpp:10: warning: no return statement in function returning non-void Button.cpp: At global scope: Button.cpp:12: error: 'Button' is not a class or namespace Button.cpp:12: error: non-member function 'QSize sizeHint()' cannot have cv-qualifier Button.cpp: In function 'QSize sizeHint()': Button.cpp:14: error: cannot call member function 'virtual QSize QToolButton::sizeHint() const' without object make: *** [Button.o] Error 1 [\CODE]

2 min later 32005473 Anonymous
>>32005457 and I realize that the code brackets didn't work.... what did I do wrong. Fucking shit day. I've spent all weekend looking for a simple fix to this and I can't figure anything out.

2 min later 32005478 Anonymous
Related. http://byuu.org/articles/qt Stop while you're still ahead.

10 min later 32005594 Anonymous
>>32005457 it can't find button.h (duh!) so it's probably a makefile/linking error. I'm not familiar with Qt, but those compiler flags look quite clusterfucky. I suggest you either scrape the makefile from a tutorial or try a dummy project without all those flags and with an almost empty main, just to debug the linking of button.h. Btw, you sure it shouldn't be with a capital B?

18 min later 32005730 Anonymous
>>32005594 There was an "example" program suggested by our TAs but I was getting this error with that too. And this code was code I gotten from a friend who had finished the program. There's obviously something wrong with my set up but we're all using a VMware given by our teacher, so it's all the same. I'm beyond lost.

23 min later 32005792 Anonymous
Add button.h to HEADERS in the file.pro (or whatever your project file is). Make sure your include paths are right. What's your directory structure like? You might need to add something like INCLUDEPATH += ./include or something to the project file

1 hours later 32006430 Anonymous
>>32005792 Sorry I abandoned this earlier. I was raging and making dinner. Anyway I decided to turn to youtube since none of the teachers were being helpful. I'm doing this simple program: https://www.youtube.com/watch?v=7Zu Ss27tQPA and I've got all his previous programs working, but I get a similar (maybe identical?) error when trying to include this: #include <QHBoxLayout> I also noticed #include <QVBoxLayout> makes the same error. I think I'm missing libraries or something. *scratches head*

1 hours later 32006501 Anonymous (2013-03-04--1362389629_343x343_scrot.png 343x343 30kB)
>>32005473 code brackets need to be lower case. Goats

1 hours later 32006522 Anonymous (2013-03-04--1362389781_458x407_scrot.png 458x407 31kB)
>>32006501 Woah what? Mine didn't work either. Huh... work, damnit!

1 hours later 32006713 Anonymous
I'm working to a solution. It's telling me there's an error in this header file: qlayoutitem.h:54 and on that line is this code: QT_MODULE(Gui)

0.598 0.097