Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MSVC2010 unresolved externals building static Qt 4.7.4 application containing Phonon
Forum Updated to NodeBB v4.3 + New Features

MSVC2010 unresolved externals building static Qt 4.7.4 application containing Phonon

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.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.
  • A Offline
    A Offline
    ash_microsec
    wrote on last edited by
    #1

    I am using MSVC2010 to build a Qt application using static Qt 4.7.4 libraries configured with the "-phonon" flag.

    When I build the application, it compiles fine, but I get the following unresolved externals:

    @1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::stop(void)" (_imp?stop@MediaObject@Phonon@@QAEXXZ)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::~MediaSource(void)" (_imp??1MediaSource@Phonon@@QAE@XZ)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class Phonon::MediaObject * __cdecl Phonon::createPlayer(enum Phonon::Category,class Phonon::MediaSource const &)" (_imp?createPlayer@Phonon@@YAPAVMediaObject@1@W4Category@1@ABVMediaSource@1@@Z)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::MediaSource(class QIODevice *)" (_imp??0MediaSource@Phonon@@QAE@PAVQIODevice@@@Z)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::play(void)" (_imp?play@MediaObject@Phonon@@QAEXXZ)
    @

    I do not know what I am missing because the MSVC2010 project settings have the following Additional Dependencies:

    @imm32.lib;winmm.lib;Ws2_32.lib;qtmaind.lib;QtCored.lib;QtGuid.lib;phonond.lib;%(AdditionalDependencies)@

    And as you can see, the phonond.lib library is in the list? What am I missing?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      does your binaries compiled with MSVC2010 compiler?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ash_microsec
        wrote on last edited by
        #3

        Yes, the application is being compiled with MSVC2010, and compiled/statically linked fine before I added the Phonon related code.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ash_microsec
          wrote on last edited by
          #4

          Still no joy resolving this. I have read conflicting answers as to whether the phonon library can be build and used statically using MSVC2010. Could someone confirm that this is definately possible in Qt 4.7.4 using MSVC2010?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            galrub
            wrote on last edited by
            #5

            from experience, and I really don't understand why, there are problems with static compiling under MSVC 2010, it seems to work good only when u use the default dynamic linking.

            I was only able to solve these EXACT unresolved symbols by going back to the default state, but, to be honest, I didn't have that much time to dig into it.

            so, here is what I would do:
            go to the source code (cpp files) and see if there are any #ifdef or #ifndef around these specific commands, because it most likely gets excluded when working with static build.
            in most cases it just pops up very quickly, so, after u figure the define that is missing got to the .pro file in the source dir of the library and edit it, added the "define += ..." to it and run qmake on it again and then nmake in the same folder.

            hope it helps,
            G

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ash_microsec
              wrote on last edited by
              #6

              Haven't been able to resolve this, so I've gone back to using shared libraries for my prototype. When I get the prototype working, I will need to revisit this issue.

              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