Project not building on windows
-
Wouldn't it be better to ask the author of the project?
@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.
@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?
-
@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.
@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?
@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?
-
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?
-
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.