I have recently bought a new computer and tried to move a python project from my old computer to my new one. The python project used some directx9 C++ code (with #include <Python.h>) to take screenshots and to compile this C++ file I used G++.
Without changing any of the code and after installing G++ and Python I found that what I used to compile the code returns an error:
g++ -std=c++11 -shared -IC:\Python27\include -LC:\Python27\libs ScreenShots/PictureStr.cpp -lpython27 -ld3d9 -lole32 -o ScreenShots/PictureStr.pyd
returns this:
C:\Python27\libs/libpython27.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
(removing the -ld3d9 -lole32 doesn't change anything)
I have no idea why this happened (and doesn't happen on any other computer that I tried or my old computer) and I wasn't able to find anything that could cause this.
In case this is relevant I use windows 10 64bit (in both my old computer and my new one).
Perhaps I need to recompile the python libs or that specific file so any advice on how to do that is also greatly appreciated.
Thank you for reading this, any advice is welcome.
I found a solution, I answered bellow.