Qt 5.3 ERROR: multiple definition of 'visu_idx"



  • This is a new error for me. I have not encountered it before so I am unsure what to provide for help other than to say this is a compile of a library and the errors occur when linking.

    Multiple modules are named in multiple areas (.o and .cpp) .

    The complete error messages read:
    "multiple definition of 'visu' modulename.cpp
    first defined here modulename.cpp"

    "multiple definition of 'visu_idx' modulename.cpp
    first defined here (.bss+3000)
    in function 'qt_noop()': modulename.o"

    The project has been cleaned completely and qmake has been run to create Makefile and
    re-compiled with no change in results as stated.

    One more observation; I am running QtCreator in a window and the console output says:
    "Cannot find absolute location of file (.bss+3000)"

    As stated, I have not seen this error before and have no idea what it all means.


  • Lifetime Qt Champion

    Hi,

    Do you have by any chance several files that have the same name ?



  • Nope. Not so luck as that.



  • UPDATE:

    Just for grins I moved the project to a Windows partition and recompiled. Exactly the same result.

    Not that this is surprising, but it does indicate something in the code or the way the compiler / linker views it.

    Hope this helps.


  • Moderators

    What exactly is visu and visu_idx? Is it by any chance a variable defined (instead of just declared) in a header?



  • Well....this is why I posted it. I have no idea what the error means nor what in the code has prompted it. As stated; I have never seen this before. So, other than the error message I have no clue what to say.

    There is definitely no module or variable name in my shared library project with anything close to this name "visu_idx".


  • Lifetime Qt Champion

    Are you on Windows ?



  • Well my original post was about a project started on Linux. I have since moved it to a Windows partition just to get a comparison. No difference. Very same errors; which led to the update post above.



  • UPDATE 2:

    I just came across an interesting page about the gnu linker:
    http://www.sourceware.org/binutils/docs-2.10/ld_3.html

    This page seems to indicate the problem may lie in the linker script specifying that the .bss is the output section specification in the script.

    I am not familiar at all with the linker internals so this means little to me, other than to say the linker seems to be having trouble with multiple definitions for the output section of the linker script (if I am understanding the information correctly).

    Someone much more familiar with the linker would know much better than I.



  • UPDATE:

    After having set this particular problem aside, I continued working on various sections of the library. Eventually, I tried a re-compile and this time I got a more cogent error message similar in nature to the above but this time siting a line in a moc_ file.

    The line pointed to is this:
    @
    void DlgSettings::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
    {
    if (_c == QMetaObject::InvokeMetaMethod) {
    DlgSettings *_t = static_cast<DlgSettings *>(_o);
    switch (_id) {
    case 0: _t->signalSettingsUpdated(); break;
    default: ;
    }
    } else if (_c == QMetaObject::IndexOfMethod) {
    int *result = reinterpret_cast<int *>(_a[0]);
    void **func = reinterpret_cast<void *>(_a[1]);
    {
    typedef void (DlgSettings::
    _t)();
    if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&DlgSettings::signalSettingsUpdated)) {
    *result = 0;
    }
    }
    }
    Q_UNUSED(_a);
    }
    @
    The error is:
    multiple definition of 'visu' in moc_mymodule.cpp line 63 (code shown above)
    first defined here mycustomwidget.cpp line 102 (custom widget class implementation)

    This custom widget was not even used in the dialog DlgSettings.

    very confusing


  • Lifetime Qt Champion

    Can you show your custom widget code ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.