0

I am working on Windows and currently have a typical hello world project. I built a static version of the QT Library. I included the header files and libs and when creating a QString I get a couple of errors..

unresolved external symbol "public: static void __cdecl QArrayData::deallocate(struct QArrayData*, unsigned __int64,unsigned __int64)" (?deallocate@QArrayData@@SAXPEAU1@K1@Z) referenced in function "public:static void __cdecl QTypedArrayData<unsigned short>::deallocate(struct QArrayData *)" (?deallocate@?$QTypedArrayData@G@@SAXPEAUQArrayData@@@Z)

unresolved external symbol "public: static struct QArrayData const * const QArrayData::shared_null" (?shared_null@QArrayData@@2QBU1@B)

2 unresolved externals

I ran dumpbin /SYMBOLS Qt5Core.lib and I see what I believe is the function it is referencing. I have also found it in the header file that is also included in my include directory. I am not sure what else I could do to fix this.

#include <iostream>
#include "QtCore/qstring.h"

QString tmp;

int main() {
    std::cout << "Hello World!";
}

What is an undefined reference/unresolved external symbol error and how do I fix it? does not answer my question. This isn't a typical unresolved symbol question it is related to specific QT libraries.

  • Could you show the command you use to build your hello world program. – john Aug 17 '22 at 17:21
  • I built in visual studio by just select the build option. Building Debug X64. – brotherman068 Aug 17 '22 at 17:22
  • Are you aware of anything else than the header which might be needed to use a library? – Yunnosch Aug 17 '22 at 17:23
  • So what steps have you taken to include the library in your hello world build? – john Aug 17 '22 at 17:24
  • I mean you said you 'included the libs' but what does that actually mean? – john Aug 17 '22 at 17:25
  • I added the libs and include directories based on the answer in this post https://stackoverflow.com/questions/23882112/how-to-add-static-libraries-to-a-visual-studio-project – brotherman068 Aug 17 '22 at 17:30
  • `I built a static version of the QT Library` do you have commercial license? This is only case when you have rigth to use static Qt library. – Marek R Aug 17 '22 at 17:32
  • @brotherman068 OK that seems correct. Based on that I would guess that you made some mistake in building the library, or Yunnosch's suggestion is correct. Sorry but it's not an easy problem to diagnose from a distance. The more information you can add to the question, the better chance that someone will be able to spot the error. – john Aug 17 '22 at 17:32
  • I followed this guide https://wiki.qt.io/Building_Qt_5_from_Git... I cloned the 5.14 repository, updated the submodules and then ran this for the configure line ```configure.bat -developer-build -opensource -nomake examples -nomake tests``` once that was complete I ran ```jom module-qtcore``` – brotherman068 Aug 17 '22 at 17:37

0 Answers0