|
-
March 23rd, 2002, 07:18 AM
#1
Problems with Qt for windows
I just downloaded Qt-non-commercial for windows and began programming. But I immediately ran into some major problems. I'm building the program under MS VC++ 6.0. I've added c:\qt\include to the include path and c:\qt\lib to the library path. The program compiles fine but linking fails with a bunch of wierd errors. For example, building this program:
Code:
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
I get these errors:
Code:
--------------------Configuration: tut1 - Win32 Debug--------------------
Linking...
tut1.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall QApplication::~QApplication(void)" (??1QApplication@@UAE@XZ)
tut1.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall QPushButton::~QPushButton(void)" (??1QPushButton@@UAE@XZ)
tut1.obj : error LNK2001: unresolved external symbol "public: int __thiscall QApplication::exec(void)" (?exec@QApplication@@QAEHXZ)
tut1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QWidget::show(void)" (?show@QWidget@@UAEXXZ)
tut1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QApplication::setMainWidget(class QWidget *)" (?setMainWidget@QApplication@@UAEXPAVQWidget@@@Z)
tut1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QPushButton::resize(int,int)" (?resize@QPushButton@@UAEXHH@Z)
tut1.obj : error LNK2001: unresolved external symbol "public: __thiscall QPushButton::QPushButton(class QString const &,class QWidget *,char const *)" (??0QPushButton@@QAE@ABVQString@@PAVQWidget@@PBD@Z)
tut1.obj : error LNK2001: unresolved external symbol "public: __thiscall QString::QString(char const *)" (??0QString@@QAE@PBD@Z)
tut1.obj : error LNK2001: unresolved external symbol "public: __thiscall QApplication::QApplication(int &,char * *)" (??0QApplication@@QAE@AAHPAPAD@Z)
tut1.obj : error LNK2001: unresolved external symbol "public: void __thiscall QStringData::deleteSelf(void)" (?deleteSelf@QStringData@@QAEXXZ)
tut1.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/tut1.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.
tut1.exe - 13 error(s), 0 warning(s)
Any suggestions?
Cheers,
cgkanchi
-
March 23rd, 2002, 07:50 AM
#2
MFC is not seeing your files buddy... did it any of your other programs work with the header files?
-
March 23rd, 2002, 08:01 AM
#3
Ok, I haven't done any QT programming on Windows but I'm sitting on some solid documentation here. This is what it says:
"Windows.......is slightly more complicated than a Linux compile:
cl -nologo -I%QTDIR%\include -c hello.cpp
link -nologo hello.obj %QTDIR%\lib\qt.lib user32.lib gdi32\lib \
comdlg32.lib ole32.lib uuid.lib imm32.lib wsock32.lib"
This is taken from a book, and explains a command-line compile. Hope it helps!
-
March 23rd, 2002, 01:55 PM
#4
I did what proactive said and after heavy modifications, the command now looks like this:
SET LIBDIR="C:\program files\microsoft visual studio\vc98\lib"
link -nologo hello.obj %QTDIR%\lib\qtmain.lib %QTDIR%\lib\qt-mt230nc.lib %QTDIR%\lib\qutil.lib %LIBDIR%\user32.lib %LIBDIR%\comdlg32.lib %LIBDIR%\ole32.lib %LIBDIR%\uuid.lib %LIBDIR%\imm32.lib %LIBDIR%\wsock32.lib %LIBDIR%\libc.lib %LIBDIR%\OLDNAMES.LIB %LIBDIR%\kernel32.lib
But it still gives me one (down from 13) error:
tut1.obj : error LNK2001: unresolved external symbol "private: static struct QSt
ringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
tut1.exe : fatal error LNK1120: 1 unresolved externals
Help!!!
Cheers,
cgkanchi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|