3

I just tried to build Qt for WinCE7.0 using VS2008 after lots of code modification I successfully compiled main libraries.

While Compiling the QtScript library I received the following linker errors:

1>Linking...
1>   Creating library ..\..\lib\QtScript4.lib and object ..\..\lib\QtScript4.exp
1>BytecodeGenerator.obj : error LNK2019: unresolved external symbol __imp__Inf referenced in function "public: static double __cdecl QTWTF::FloatHashTraits<double>::emptyValue(void)" (?emptyValue@?$FloatHashTraits@N@QTWTF@@SANXZ)
1>Executable.obj : error LNK2001: unresolved external symbol __imp__Inf
1>MathObject.obj : error LNK2001: unresolved external symbol __imp__Inf
1>DateMath.obj : error LNK2019: unresolved external symbol __imp__Nan referenced in function "double __cdecl QTWTF::parseDateFromNullTerminatedCharacters(char const *,bool &,int &)" (?parseDateFromNullTerminatedCharacters@QTWTF@@YANPBDAA_NAAH@Z)
1>JSValue.obj : error LNK2001: unresolved external symbol __imp__Nan
1>..\..\lib\QtScript4.dll : fatal error LNK1120: 2 unresolved externals

I have absolutely no idea which libraries I missed to link with!

Thanks

Kevin
  • 53,822
  • 15
  • 101
  • 132
Alno986
  • 51
  • 1
  • 7
  • So, what have you tried already? Have you read the documentation? Have you looked at the internet? Let us not commit the same mistakes. – Sebastian Mach Dec 22 '11 at 11:51
  • Does this help at all? http://developer.qt.nokia.com/wiki/Qt_Library_Cross_Dependencies – Stuart Golodetz Dec 22 '11 at 12:56
  • Well I have searched the internet but no useful results yet, it seems to me like a sort of obvious mistake or something. I am a Linux programmer forced to just compile this project on windows due to some hardware issue, so it's quit possible to miss something obvious. You know, there are a few people knowing the obvious things ;) – Alno986 Dec 24 '11 at 05:59
  • Thanks Stuart but those are the dependencies of a Qt program not the Qt it self. I am actually trying to compile Qt. – Alno986 Dec 24 '11 at 06:50

1 Answers1

1

If you're using Windows, I'll assume you're building in MSVS. I often start projects WITHOUT default libs and if I happen to touch "out of reach" terriotry from another lib, I add what I need as I go along.

Fortunately, MSVS is great at helping me with this. Just turn VERBOSE compiling status and see what libs it's trying to access, then just add them: right click the project, linker, show progress -> select VERBOSE

Another method is when I check MSDN for Microsoft functions and see the lib they are declared in and add it (since VERBOSE can be overkill on my poor output window). I don't know if Qt has a detailed reference documentation (also stating the libs) but it's worth a shot.

When all else fails, just add all libs Qt could possibly want (make sure IGNORE STANDARD LIBS is disabled) then check VERBOSE and only keep those in the list.

Assuming you have all the libraries in the project, another problem is mismatched dependencies (right click the solution, startup project -> select the one you need, [project dependencies -> map each dependency for the specified libs).

Also make sure when you import an extern the lib is defined in Linker->Input.

However, if you modified the source (either adding new functions/global or static vars or you modified function signatures), the unresolved external reference means a function/var definition has no associated body. Either implement one or add { } in the definition; so if that's the case, check the functions/vars from the error message.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
TheNomad
  • 892
  • 5
  • 6
  • Thanks for your comprehensive response. Running linker in verbose mode does not seems like a good idea, you know I don't actually know which library I should link with, so running the linker in verbose mode would not help. Well I tried it anyway but it didn't help. I tried your second solution but still no success; However I can't link Qt against all the libraries found on my PC, I think Qt knows what it needs in it's default configuration. As I said before I am a linux programmer and I am not familiar with windows native lib, so I think something obvious is missing there. – Alno986 Dec 27 '11 at 10:23
  • Well, VERBOSE shows what functions are needed by each lib. It might be a problem because you aren't linking to it and most likely this may be the reason it didn't help you. Have you tried building DEBUG vs RELEASE ? There are situations where one works and the other doesn't. You also said you modified it to build for CE so perhaps some libs are missing... try getting the latest Microsoft SDK if all else fails... And if this still doesn't help, I am curious about one thing: are the Nan and Inf references defined in Qt or are they in your own lib\exe outside of the Qt framework ? – TheNomad Dec 29 '11 at 11:46