After developing my application in Qt on my computer (linux) I'm having a hard time compiling it outside of it. Some things I have solved, but now it gives me problems since I use Python. So, in the corresponding file I have this:
#include "/usr/include/python3.6m/Python.h"
(In fact, I think that only in linux it could cause problems for someone who wants to compile it and does not have exactly python in that path)
But in this case it is that the Python path in Windows is different, and it gives me the logical and corresponding error.
So the question is... could I define this path in such a way that it looks for the files in one place or another depending on whether I am in windows or linux.
And now to make the question longer....and in general would there be a way for me to look up the Python path and set the #include
proper one?
Edit:
Following @eyllanesc's answer, I show my modification in the pro file, in case someone else has more clarification:
unix{
LIBS += -L /usr/local/lib/python3.6 -lpython3.6m
INCLUDEPATH += /usr/include/python3.6m
}
win32{
LIBS += -L C:\Python\Python37\libs -lpython37
INCLUDEPATH += C:/Python/Python37/include
}
In general it is not a good practice to place an include using the absolute path of an external library.
So assuming you are using qmake for your project then you can shorten the path using INCLUDEPATH:
*.pro
and only use
#include <Python.h>
to include the library.So considering the above it is only necessary to change the INCLUDEPATH according to the OS, and qmake allows it easily: