Project not building on windows
-
wrote on 10 Aug 2022, 14:23 last edited by Creaperdown 8 Oct 2022, 14:24
Hey, I am currently working on a project, which works all fine on linux, but doesnt seem to build on windows.
I wouldnt exactly know what code to provide. What I am building is this: https://github.com/Librum-Reader/Librum.
Does anyone have an idea why these errors could occur?I noticed that it shows me (at the bottom of the error message), that there is an undefined reference to my signals, which I find weird, since I use the Q_OBJECT macro in all my classes
Thanks in advance
-
Wouldn't it be better to ask the author of the project?
-
Wouldn't it be better to ask the author of the project?
wrote on 10 Aug 2022, 15:19 last edited by@Christian-Ehrlicher Well, I am the author
-
"undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.
-
"undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.
wrote on 10 Aug 2022, 15:41 last edited by@kkoehne I see, I'll try this. Is it generally enough to put Q_DECL_EXPORT infront of every class I want to use from another binary?
-
Hi,
Not Q_DECL_EXPORT but yes you have to export all the classes you want to use from your library.
See how it is done in the documentation @kkoehne linked.
-
wrote on 10 Aug 2022, 17:59 last edited by
Hi,
it maybe depend on your access permission to Storage -
@ali-aydin said in Project not building on windows:
Hi,
it maybe depend on your access permission to StorageNo it's not. If it was access permission related, @Creaperdown wouldn't be able to build the library in the first place.
-
"undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.
wrote on 11 Aug 2022, 19:28 last edited by@kkoehne I've tried following the docs on a small project I set up (which has the same issue, I think my other project has) but it still doesnt work. https://github.com/Creapermann/Temp
-
@Creaperdown , I just successfully compiled the latest HEAD (d5e98b8c6cc17abe) of your repository on Windows, with MinGW and MSVC:
C:\dev\tmp\Temp>cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 . -- The CXX compiler identification is GNU 11.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Found WrapVulkanHeaders: C:/VulkanSDK/1.2.176.1/Include -- Configuring done -- Generating done -- Build files have been written to: C:/dev/tmp/Temp/mingw-build C:\dev\tmp\Temp>cmake --build mingw-build [21/21] Linking CXX executable appTesting.exe
What compiler are you using, and what is the exact compiler output you get?
-
@Creaperdown , I just successfully compiled the latest HEAD (d5e98b8c6cc17abe) of your repository on Windows, with MinGW and MSVC:
C:\dev\tmp\Temp>cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 . -- The CXX compiler identification is GNU 11.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Found WrapVulkanHeaders: C:/VulkanSDK/1.2.176.1/Include -- Configuring done -- Generating done -- Build files have been written to: C:/dev/tmp/Temp/mingw-build C:\dev\tmp\Temp>cmake --build mingw-build [21/21] Linking CXX executable appTesting.exe
What compiler are you using, and what is the exact compiler output you get?
wrote on 12 Aug 2022, 14:21 last edited by@kkoehne I am using the same setup you do. I have Qt 6.3.1 and am using mingw_64. When I am running the exact same command you do, in the command line, I get following error:
cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 . -- The CXX compiler identification is GNU 6.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/MinGW/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:22 (find_package): Could not find a configuration file for package "Qt6" that is compatible with requested version "6.2". The following configuration files were considered but not accepted: C:/Qt/6.3.1/mingw_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.3.1 (64bit) -- Configuring incomplete, errors occurred! See also "C:/Users/prtnp/Programming/Temp/Temp/mingw-build/CMakeFiles/CMakeOutput.log".
Do you have an idea why this doesnt work? Looking around I only find that not using CMAKE_PREFIX_PATH could cause this, but I do.
Also, when using QtCreator, it compiles but it doesnt run. Does the application run for you?
-
wrote on 12 Aug 2022, 19:37 last edited by
Also, I've realized I am using mingw_64, which exports all symbols by default, so I don't think that exporting the symbols is the problem. Does anyone have another idea?
-
wrote on 12 Aug 2022, 23:34 last edited by
In your compilation example you have:
-- The CXX compiler identification is GNU 6.3.0
Please use a newer MinGW. The one from Qt SDK should be 11.2.0.
In your temp project you have:
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
Please remove the
6.2
part, which doesn't play well with Qt version 6.3.1 given via-DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64
. -
@cristian-adam said in Project not building on windows:
Please remove the 6.2 part, which doesn't play well with Qt version 6.3.1 given via -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64.
I think this should actually be fine, because 6.3.1 is compatible with 6.2, and no EXACT is set.
But yes, the GCC compiler version is too old.
5/14