开发者

Basic compile issue with QT4

I've been trying to get a dead simple listing from a university textbook to compile with the newest QT SDK for Windows I downloaded last night. After struggling through the regular nonsense (no make.bat, need to manually add environment variables and so on) I am finally at the point where I can build. But only one of the two libraries seem to work.

The .pro file I use is dead simple:

SUBDIRS += utils \
           dataobjects

TEMPLATE = subdirs

In each of these two subfolders I have the source for a library. Running QMAKE generates a makefile and running Make runs through all the preliminaries and then fails on the g++ call:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc --out-implib,libdataobjects.a -shared -mthreads -Wl -Wl,--out-implib,c:\Users\Cobus\workspace\lib\libdataobjects.a -o ..\..\lib\dataobjects.dll object_script.dataobjects.Debug  -L"c:\Users\Cobus\Portab~1\Qt\2010.02.1\qt\lib" -LC:\Users\Cobus\workspace\lib -lutils -lQtXmld4 -lQtGuid4 -lQtCored4
c:/users/cobus/portab~1/qt/2010.02.1/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lutils

The problem seems to be right near the end of the command line, where -lutils is added, indicating that there is a library by the name of utils. While I would have expected to see that, you'll notice the library names after --out include lib in the na开发者_开发技巧me, so they become libutils and libdataobjects. I have tried to figure out why this is happening, to no avail.

Anyone have an idea what's going on?


You .pro file uses the SUBDIRS template which requires a .pro file matching the directory name for each subdir. You should have a utils\utils.pro and dataobjects\dataobject.pro file as well.

Is c:\Users\Cobus\workspace\lib\libdataobjects.a built correctly? If not, check the sub directory .pro files.

With what you posted, I would not expect anything to compile. You need targets in the sub-directory .pro files to build anything.


Their seems to be another pro file as the generated Makefile is pulling QtXml which it wont do by default.

Please check the subdirs for any .pro or .pri files .. one of them will have answer to your confusion

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜