Qt Creator Error Undefined Reference To
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies qt undefined reference to _imp__ of this site About Us Learn more about Stack Overflow the company
Qt Undefined Reference To Signal
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges qt creator undefined reference to constructor Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: qt undefined reference to external library Sign up Getting “undefined reference” in QT Creator when calling defined function up vote 3 down vote favorite 1 So, I'm reading this book: C++ GUI Programming with Qt 4, Second Edition by Jasmin Blanchette; Mark Summerfield, in order to learn GUI programming. And while following thew book's steps to create a simple spreadsheet application I get an "undefined reference" error when
Undefined Reference To Qt_version_tag
I try to compile the Spreadsheet widget. All the errors seem to be originated from the Cell *Spreadsheet::cell(int row, int column) function: Cell *Spreadsheet::cell(int row, int column) const { return static_cast
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About qt add library Us Learn more about Stack Overflow the company Business Learn more about hiring qt undefined reference to vtable developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
C++ Undefined Reference
the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Undefined reference” error in Qt http://stackoverflow.com/questions/9643451/getting-undefined-reference-in-qt-creator-when-calling-defined-function Creator up vote 0 down vote favorite I'm trying to import some working Visual C++ code into Qt Creator and I'm having some compilation error I can't explain. This is my code: // TabSprite.h #include
problem because I can't seem to solve it and a http://www.cplusplus.com/forum/unices/78756/ very nice fella at stackoverflow.com was unable to help me with it. My problem is this: I have a library that I have built http://www.qtforum.org/post/95305/slots-and-undefined-reference-to-class-function.html in Qt Creator but compiled with MSVC 2008, it yeilded a .lib file (i.e. MyLibrary.lib) I am linking into a testing application I have undefined reference built in Qt 4.8.1 using Qt Creator by adding the following line to my .pro file: LIBS += FontSystem.lib and I am compiling that project with MinGW (g++) and it consistantly gives me this error: main.cpp:-1: error: undefined reference to `NGUI::CFont::CFont()' The thing it's looking for is the undefined reference to constructor of the class CFont inside the NGUI namespace. I have also tried compiling this with MSVC, but to no avail. Here is main.cpp: 1
2
3
4
5
6
7
8
9
10
11
12
#include "fontsystem.h" int main(int argc, char *argv[]) { cout<< "Starting the FontSystem..."<< endl; NGUI::CFont *cFont = new NGUI::CFont(); cout<< "FontSystem Started!"<< endl; system("PAUSE"); return 0; } and here is fontsystem.h: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef FONTSYSTEM_H #define FONTSYSTEM_H // Include the Basic C++ headers. #include
QtForum.org » Qt » Qt Programming » Slots and undefined reference to 'class::function' Skip user information tkurowski Beginner Posts: 17 1 Thursday, May 21st 2009, 8:43pm Slots and undefined reference to 'class::function' Well Im trying to make my first QT app and I've come to an error that I would have imagined I could easily find (but I cant!) Im using creator. I use the wizard to make a qdialog class. ive designed the dialog in designer, connecting only the cancel button to close(). the only thing i've added to the given code was "public slots: ... void hi();" Source code 1 2 3 4 5 6 7 8 9 10 11 12 13 class buddhabrot : public QDialog { Q_OBJECT public: buddhabrot(QWidget *parent = 0); ~buddhabrot(); private slots: //i added this void hi(); //and this private: Ui::buddhabrot *ui; }; errors: C:/Documents and Settings/t/My Documents/buddhabrot/debug/moc_buddhabrot.o:-1: error: In function `ZN10buddhabrot11qt_metacallEN11QMetaObject4CallEiPPv': C:/Documents and Settings/t/My Documents/buddhabrot/debug/moc_buddhabrot.cpp:66: undefined reference to `buddhabrot::hi()' :-1: error: collect2: ld returned 1 exit status what is wrong? ive tried tons of tutorials from the suggested book (c++ gui programming with qt 4, second edition). it used a different format because it didnt deal with automatically given files, but the way ive declared it is the same! (and the tutorials worked fine) eeeeek! Cheers, Tom Go to the top of the page Skip user information Junior Professional Posts: 1,623 Location: San Antonio, TX USA Occupation: Senior Secure Systems Engineer 2 Thursday, May 21st 2009, 9:42pm tkurowski, Undefined reference - did you create the function in the src (.cpp) file? *.cpp Source code 1 2 3 4 void buddhabrot::hi() { // do something... } Also whenever you add signals/slots it's a good idea to re-run qmake. Junior Go to the top of the page Skip user information tkurowski Beginner Posts: 17 3 Thursday, May 21st 2009, 11:23pm I almost didnt want to reply out of embarrassment. I thought I could just do a forward declaration like that without specifying class::function additionally. Thanks mate Tom Go to the top of the page Jump to: ----------------------- QtForum.org QtForum Tutorials, Tips and snippets Qt Qt Embedded, Qtopia, QSA Qt Programming KDE Development Qt Designer Installing Qt Other Forums C++ programming Offtopic Job Forum commercial jobs non commercial Help Legal Notice Terms of use Tuesday, October 25th 2016, 1:22am Go to the top of