Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [SOLVED] Very strange errors when building a Qt project in MSVS
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Very strange errors when building a Qt project in MSVS

Scheduled Pinned Locked Moved 3rd Party Software
7 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ilix
    wrote on last edited by
    #1

    Hello!

    I have a very strange problem that makes me completely puzzled.

    I'm working in MSVS 2012 with the Visual Studio Add-in 1.2.2 installed, and in my project I'm using Intel's Perceptual SDK. So I have to link two of their libraries (*.lib files). Now if I use a "New project..." wizard to create, say, simple "MFC application" or "Win32 console application", everything works fine.
    But if use it to create a "Qt application" I get 6 "unresolved external symbol" errors when building the project. And these unresolved symbols are not about Qt, they are about Intel's SDK! Here are just 3 of them:
    @
    1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall UtilPipelineFace::EnableFaceLocation(unsigned short *)" (?EnableFaceLocation@UtilPipelineFace@@UAEXPAG@Z)

    1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall UtilPipelineFace::EnableFaceLandmark(unsigned short *)" (?EnableFaceLandmark@UtilPipelineFace@@UAEXPAG@Z)

    1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall
    UtilPipelineGesture::EnableGesture(unsigned short *)" (?EnableGesture@UtilPipelineGesture@@UAEXPAG@Z)
    @
    So I link exactly the same two Intel’s libraries and when building a "standard" Visual C++ project everything is ok, but when building a "Qt" project these unresolved symbols appear out of nowhere!

    And this problem is not about wrong library path/name or whatever. If I remove any of these 2 libraries from the linker’s input I get more than 6 unresolved symbols. And at the same time just these 2 libraries works fine for the “standard” Visual C++ projects.

    So as I’ve already said I have no idea what’s going on. Has anybody experienced something like this? Or do you have any ideas why it can happen? I would really appreciate.

    [edit, code tags added, koahnig]

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Could you compare the linker flags from your working project and the one from your Qt project ?

      There might be some difference that could explain the strange behavior

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ilix
        wrote on last edited by
        #3

        Hello, SGaist. Thank you for the welcome and for your reply. I've compared linker's command lines for both projects. There were some differences(namely /INCREMENTAL and /SAFESH flags), but I've made them completely identical, except for the project-related files (OUT location, *.pdb file, *.pgd file, *.manifest file). It didn't help :(
        Now I feel even more puzzled. What else can it be???

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Ilix
          wrote on last edited by
          #4

          I figured it out at last! It was all about the /Zc:wchar_t (wchar_t Is Native Type) flag of the compiler. It affects C++ decorated names - that's why I had linker errors. Discussion of this problem can be found here:
          http://social.msdn.microsoft.com/Forums/vstudio/en-US/1ebc23cd-ecb5-489c-9652-72eac8db3587/zcwchart-causes-linking-errors.

          P. S. Anyway, thanks for your answer! It made me think in the right direction ;)

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You're welcome !

            As a side note, this flag changed from Qt 4 to Qt 5. Depending on the libraries you are using you can also rebuild Qt changing the value of that flag in the mkspec.

            Don't forget to update the thread's title to solved so other forum users may know a solution has been found :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • I Offline
              I Offline
              Ilix
              wrote on last edited by
              #6

              Thanks for your tips. In the qmake.conf from the Qt 5.1.0 sources I found:

              QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t

              Looks like it is compiled WITH "wchar as a native type" by default.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Yes, this started with Qt 5

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved