Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Qt link errors (Q_INIT_RESOURCE)

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Tue, 30 Mar 2021 16:38:08 -0700
What versions of CMake and Qt are you using? I enabled CMAKE_AUTORCC earlier on in the configuration process in be2b0fc810, which might have caused this. You might try moving `set(CMAKE_AUTO...` back to ui/qt/CMakeLists.txt, but if that fixes the problem then we might have to enable CMAKE_AUTO* earlier or later depending on our CMake version.

I also noticed that https://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE says

"This macro cannot be used in a namespace. It should be called from main()."

Maybe we need to move our Q_INIT_RESOURCE calls from wireshark_application.cpp to main.cpp?

On 3/30/21 2:15 AM, Martin Mathieson via Wireshark-dev wrote:
I started getting this link error a day or 2 back:

[ 98%] Linking CXX executable run/wireshark
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: ui/qt/CMakeFiles/qtui.dir/wireshark_application.cpp.o: in function `WiresharkApplication::WiresharkApplication(int&, char**)':
/home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:639: undefined reference to `qInitResources_about()'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:640: undefined reference to `qInitResources_i18n()'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:641: undefined reference to `qInitResources_layout()'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:642: undefined reference to `qInitResources_stock_icons()'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:643: undefined reference to `qInitResources_wsicon()'
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /home/martin/wireshark_gl/ui/qt/wireshark_application.cpp:644: undefined reference to `qInitResources_languages()'
collect2: error: ld returned 1 exit status

Haven't worked out exactly why this is happening (or at which commit it started to fail).  If I do need to update Qt, the minimum version check in CMake isn't catching it.

Martin


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe