External library throws undefined reference errors in Qt Creator
Link order is important here. You need to make sure the -lXinerama
option is added after the -lovr
option. qmake should preserve the order of libraries as you add them in your .pro
file.
See this answer for more information.
Why qt project can throw errors like undefined reference to `__imp_ Py_Initialize' and so on?
Python (at least the official binaries) for Win is built using VStudio ([Python.Wiki]: WindowsCompilers).
According to an output line added after a while (:-1: error: collect2.exe: error: ld returned 1 exit status
), it seems a different build toolchain (looks like a port from Nix (MinGW, MSYS2, Cygwin, ...)) is used.
It's generally advisable not to mix build toolchains, as that could yield errors (at build time, or (even worse) crashes at runtime). Check [SO]: How to circumvent Windows Universal CRT headers dependency on vcruntime.h (@CristiFati's answer) for a remotely related example.
Try setting VStudio (might need to install it - Community Edition is free) in your .pro file, like in the image below (don't mind the older version, this is what I have configured already):
This (original answer) is a generic advice and is not the cause for the current failure, as the library is automatically included (via pyconfig.h).
You specified where the linker should search for libraries, but you didn't specify which libraries to use. Check [SO]: How to include OpenSSL in Visual Studio (@CristiFati's answer) for more details on building on Win.
Inside Python's lib directory ("D:/workplace/Python/libs" in your case), there should be a file called python${PYTHON_MAJOR}${PYTHON_MINOR}.lib depending on which Python version you are using (e.g. python39.lib for Python 3.9). You need to let the linker know about it:
LIBS += -L"D:/workplace/Python/libs" -lpython39
Note: On Win you don't have to separately install Python packages (python*, libpython*, libpython*-dev, ...) as they are all contained by the (official) installer.
Qt Creator: Unresolved External Symbol
It looks like you ran across this problem:
https://github.com/libgit2/libgit2/issues/741
You can try the suggestion from here:
https://github.com/libgit2/libgit2/pull/749#issuecomment-6434565
When building on Windows with the MSVC tool chain, the default build
uses the __stdcall convention. However this is not reflected in the
header files, so you have to use the /Gz compiler option in your own
build as well for being able to successfully link with a libgit2 built
that way. If this is not possible or not desirable, set the
-DSTDCALL=OFF option when doing the initial cmake.
Related Topics
Changing the Current Directory in Linux Using C++
Intercepting/Rerouting Tcp Syn Packets to C++ Program in Linux
Building Glew on Windows with Mingw
How to Create a Static Library with G++
Is the Order of Iterating Through Std::Map Known (And Guaranteed by the Standard)
Function Pointers Casting in C++
May I Take the Address of the One-Past-The-End Element of an Array
What Is the Purpose of Using -Pedantic in the Gcc/G++ Compiler
C++11 Stl Containers and Thread Safety
How to Compile SQLite with Icu
Range-For-Loops and Std::Vector<Bool>
Arrow Operator (->) in Function Heading
How to Use Std::Sort to Sort an Array in C++