QT Creator: undefined reference to 'WinMain#16' - qt

I am building a Unit-Test using this tutorial. However, when compiling my code I get these two errors:
undefined reference to 'WinMain#16'.
collect2: ld returned 1 exit status.
why is this happening?

Did you create a main function where you create a qapplication? There's a good example here
You can also get that error when you're creating a DOS executable instead of a Windows GUI executable. It's looking for winmain() not main(),

Related

libQt5SerialPort.so.5: undefined reference to `udev_device_get_devnode#LIBUDEV_183 when cross-building Qt-everywhere-src-5.13.1 for BeagleBone Black

I am new to using Qt (and building it).
I have searched on the web and landed at multiple ways of cross-building the Qt src for Beaglebone Black, of multiple versions, but haven't been successful to build any of those.
I am following the guide from one of the GitHub pages here.
The configure and make commands worked fine and didn't give any errors (just some warnings).
But when I tried "make install", the build continued until I was bombarded with a bunch of errors for with the 'libQt5SerialPort.so.5' and fails ultimately with 'Error 1' and 'Error 2'.
Here's the terminal log which give the undefined reference errors:
make[4]: Entering directory '/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus/src/tools/canbusutil'
/home/yash/BBB/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/yash/BBB/sysroot -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../lib -Wl,-rpath-link,/home/yash/BBB/qt-everywhere-src-5.13.1/qtbase/lib -Wl,-rpath-link,/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib -o ../../../bin/canbusutil .obj/main.o .obj/readtask.o .obj/canbusutil.o .obj/sigtermhandler.o .obj/moc_readtask.o .obj/moc_canbusutil.o .obj/moc_sigtermhandler.o /home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus/lib/libQt5SerialBus.so /home/yash/BBB/qt-everywhere-src-5.13.1/qtbase/lib/libQt5Core.so -lpthread -lrt -lpthread -ldl
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_list_entry_get_next#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_new#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_new_from_syspath#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_get_parent#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_enumerate_new#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_unref#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_enumerate_add_match_subsystem#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_enumerate_get_list_entry#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_get_driver#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_get_sysname#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_unref#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_enumerate_scan_devices#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_list_entry_get_name#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_get_property_value#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_enumerate_unref#LIBUDEV_183'
/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialport/lib/libQt5SerialPort.so.5: undefined reference to `udev_device_get_devnode#LIBUDEV_183'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:99: ../../../bin/canbusutil] Error 1
make[4]: Leaving directory '/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus/src/tools/canbusutil'
make[3]: *** [Makefile:59: sub-canbusutil-install_subtargets] Error 2
make[3]: Leaving directory '/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus/src/tools'
make[2]: *** [Makefile:112: sub-tools-install_subtargets] Error 2
make[2]: Leaving directory '/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus/src'
make[1]: *** [Makefile:61: sub-src-install_subtargets] Error 2
make[1]: Leaving directory '/home/yash/BBB/qt-everywhere-src-5.13.1/qtserialbus'
make: *** [Makefile:178: module-qtserialbus-install_subtargets] Error 2
I have tried clean building the same multiple times, but always faced the same issue.
Can someone please help with figuring out what is going wrong here?
Thanks a ton.
I think using an updated image and the qt5 libs. available would be easier for you.
For instance, when you get the image and write it to SD Card from https://forum.beagleboard.org/t/debian-11-x-bullseye-monthly-snapshots/31280 , you can then use this command:
apt search qt5
That will allow you to search for all that is available from qt5 in the Debian Buster or Bullseye Distro(s).
Enjoy. Oh...Bullseye uses apt search while Buster uses apt-cache search.
I have been researching a bit more:
https://doc.qt.io/embedded.html
https://doc.qt.io/QtForMCUs-2.1/qtul-supported-platforms.html#other-target-boards
The idea behind cmake, make, installing on the BBB is far beyond what we can discuss on this forum. I cannot pinpoint the issue from the info. given thus far.
If and when you find time, please visit forum.beagleboard.org and they have many people that are knowledgeable on the BBB on that site.
To anyone trying to build Qt for cross-compilation for BeagleBone Black, following this guide properly would work.
PS: It should be kept in mind to download qtcreator with a version equivalent to or older than the qt-source being built.

An error occurred when the ASAP(Automated Slide Analysis Platform) software was running

With the enthusiastic help of SO netizens, I configured all the environments required for ASAP (Automated Slide Analysis Platform)
The necessary libraries including Boost, Openslide, Qt, etc. have been successfully linked, but the following error occurred
====================[ Build | ASAP | Debug ]====================================
"D:\_Jason\Clion\CLion 2021.2.2\bin\cmake\win\bin\cmake.exe" --build D:\_Jason\C++_hospital\orignal\CLion1.9\ASAP-1.9\cmake-build-debug --target ASAP -- -j 9
[ 25%] Automatic MOC and UIC for target ASAP
[ 25%] Built target ASAP_autogen
[ 50%] Linking CXX executable ASAP.exe
CMakeFiles\ASAP.dir/objects.a(main.cpp.obj): In function `main':
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationC1ERiPPci'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPC1EP7QWidget'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:8: undefined reference to `__imp__ZN7QWidget4showEv'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:10: undefined reference to `__imp__ZN12QApplication4execEv'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationD1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\ASAP.dir\build.make:111: ASAP.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:163: CMakeFiles/ASAP.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:170: CMakeFiles/ASAP.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:168: ASAP] Error 2
It can be seen from "__imp__ZN12QApplicationD1Ev" that this is a Qt problem. The solution they gave in other forums is to add the statement QT += gui widgets core to the .pro file under this project.However, there is no .pro file in the ASAP source code, so I tried to use the qmake -project command to generate the .pro file. It still doesn't work after adding QT += gui widgets core

Compile error in Arduino IDE using Mozzi library

I'm using the Mozzi lib (http://sensorium.github.io/Mozzi/) as part of a tutorial (http://www.echanter.com/home/howto-build#TOC-Arduino-IDE). I included the Mozzi in Arduino Studio and followed minor configs in the tutorial. I've looked around the lines that are reported, but I'm stumped. Compile error is:
Mozzi/mozzi_fixmath.cpp.o: In function isqrt16(unsigned int)': /home/temp/sketchbook/libraries/Mozzi/mozzi_fixmath.cpp:156: multiple definition of isqrt32(unsigned long)'
echanter.cpp.o:/home/temp/sketchbook/libraries/Mozzi/Sample.h:61: first defined here
collect2: error: ld returned 1 exit status
In the root dir are two files with isqrt16(unsigned int) defined: mozzi_fixmath.cpp and mozzi_fixmath.h. I commented out the definition in the cpp file and it compiled.

error LSF: undefined symbol: _ZN3ajn15_RemoteEndpoint17 [alljoyn]

I have a trouble with LSF alljoyn 15.04, I build LSF in ubuntu 16.04 success but I cannot run any app. I'm receiving Notification whenever I run the ./lighting_controller_client_sample in service_framework-15.04/core/service_framework/build/linux/standard_core_library/lighting_controller_client/samples:
./lighting_controller_client_sample: symbol lookup error:
./lighting_controller_client_sample: undefined symbol:
_ZN3ajn15_RemoteEndpoint17PushMessageRouterERN3qcc10ManagedObjINS_8_MessageEEERm
How can I fix it?
Sounds like it can't find cpp libs (the .a and .so files).
In which case you need to define LD_LIBRARY_PATH.
For example, if you are building alljoyn with scons, then define the following environment variable before running your sample.
export LD_LIBRARY_PATH=/core/alljoyn/build/linux/x86_64/release/dist/cpp/lib
or
export LD_LIBRARY_PATH=/core/alljoyn/build/linux/x86_64/debug/dist/cpp/lib
That will at least allow it to find the alljoyn cpp lib files.

qt5 and usblib in win7 (mingw32) linker produces undefined references to `_imp__SetupDiGetClassDevsA#16'

I'm using qt5.5 in linux and win7 (mingw32) ... in linux it works (i had to build new usblibs for compatibility reasons)
in windows using this library
/usr/local/.../code-qt/libusb-1.0.19-rc1-win/MinGW32/static/
i get the following errors and a few more, all with some
"_imp__SetupDixxxxxxx" being undefined
since the libusb build in windows seems quite more complicated, i was unable to figure out how to do it
at this point i have no clue what is wrong and any help is highly appreciated
i have no problems rebuilding the lib with ming32w inside or outside of qt5 creator or any other way, but i would need to have a few steps described on how to proceed.
cheers EinHexenMeister
E:\code-qt\qtHidTest\HidTest\windows\hid.c:289: error: undefined reference to `_imp__SetupDiGetClassDevsA#16'
E:\code-qt\qtHidTest\HidTest\windows\hid.c:298: error: undefined reference to `_imp__SetupDiEnumDeviceInterfaces#20'
E:\code-qt\qtHidTest\HidTest\windows\hid.c:491: error: undefined reference to `_imp__SetupDiDestroyDeviceInfoList#4'
E:\code-qt\qtHidTest\HidTest\windows\hid.c:313: error: undefined reference to `_imp__SetupDiGetDeviceInterfaceDetailA#24'
E:\code-qt\qtHidTest\HidTest\windows\hid.c:347: error: undefined reference to `_imp__SetupDiEnumDeviceInfo#12'
You need to link additional libraries for windows, add in your .pro file:
win32 {
LIBS += -lhid -lsetupapi
}

Resources