Compile error under Windows in current develop revision
Currently, compiling a fresh checkout with mingw under Windows 64bit gives the following error:
compiling ../../../../src/libs/qmuparser/qmuparsertest.cpp
compiling ../../../../src/libs/vpropertyexplorer/vserializedproperty.cpp
..\..\..\..\src\libs\qmuparser\qmuparsertest.cpp: In member function 'int qmu::Test::QmuParserTester::TestInfixOprt()':
..\..\..\..\src\libs\qmuparser\qmuparsertest.cpp:696:33: error: 'M_PI' was not declared in this scope
iStat += EqnTest ( "-_pi", -M_PI, true );
^
..\..\..\..\src\libs\qmuparser\qmuparsertest.cpp: In static member function 'static int qmu::Test::QmuParserTester::EqnTest(const QString&, double, bool)':
..\..\..\..\src\libs\qmuparser\qmuparsertest.cpp:1293:52: error: 'M_PI' was not declared in this scope
p1->DefineConst ( "pi", static_cast<qreal>(M_PI) );
^
..\..\..\..\src\libs\qmuparser\qmuparsertest.cpp:1294:51: error: 'M_E' was not declared in this scope
p1->DefineConst ( "e", static_cast<qreal>(M_E) );
^
Makefile:1178: recipe for target 'obj/qmuparsertest.o' failed
mingw32-make[3]: *** [obj/qmuparsertest.o] Error 1
mingw32-make[3]: Leaving directory 'C:/LW_D/MinGW-Projects/Valentina/build/src/libs/qmuparser'
Makefile:50: recipe for target 'sub-qmuparser-make_first' failed
mingw32-make[2]: *** [sub-qmuparser-make_first] Error 2
mingw32-make[2]: *** Waiting for unfinished jobs....
Comments (11)
-
repo owner -
I see, this seems to be a nasty problem... Can I help in any way?
EDIT: If you google this, it seems to be a problem with MinGW and not simply Windows... Some people say, it could be solved by simply adding this:
#ifndef M_PI #define M_PI 3.14159265358979323846 #endif
also see: http://stackoverflow.com/questions/26065359/m-pi-flagged-as-undeclared-identifier
-
As I'm trying to compile everything successfully, it seems to be a possible solution to add
#ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif
to different files. I'm trying to investigate, which ones...
see: https://sourceforge.net/p/mingw-w64/mailman/message/32319536/
-
Hey Roman! I created a pull request and hopefully it is ok what I've done... With these changes everything works so far.
EDIT: Question: I should have surrounded my defines with Q_OS_WIN additionally???
-
repo owner My first advice for you is to check your PATH variable.
-
repo owner The second, is to use qmath.h file. It should fix all problems.
-
I don't understand, what this has to do with my PATH variable, because it never changed since my first successful compilation months ago... And regarding qmath.h, from what I understand, systematically this would have to be used anywhere instead of math.h, right? As I told you before, I'm not deep enough into C++ to decide such things.
I just thought, that if, on Windows, a somewhat official solution could be used here, it is the way to go. If you, as your programming experience is light years further than mine, decide to go a more general (in this particular situation, more OS-independent) but (for me) complicated way, then please decline my pull request and I'm totally fine with it, for sure!
Sadly, I wont be of any help, then, because I won't be the one to decide which *.h to use and where...
-
repo owner I don't understand, what this has to do with my PATH variable, because it never changed since my first successful compilation months ago...
I just wanna be sure your path is right. I know enough examples when in one case compiler can find header and in other not. Also your case is very strange for me because i check my code on appveyor.com and it was builded succesfully.
I don't understand, what this has to do with my PATH variable
For example math.h is inside C:\Qt\Qt5.4.0\5.4\mingw491_32\include. and this path should be theoretically in PATH variable. Maybe this is reason why it can't find it. But for example appveyor.com succesfully build without it.
And regarding qmath.h, from what I understand, systematically this would have to be used anywhere instead of math.h, right?
Yes, looks like.
I just thought, that if, on Windows, a somewhat official solution could be used here, it is the way to go. If you, as your programming experience is light years further than mine, decide to go a more general (in this particular situation, more OS-independent) but (for me) complicated way, then please decline my pull request and I'm totally fine with it, for sure!
Your solution works on Windows. But i am not satisfied about it. Yes, i want more OS-independent way. Especially because we need keep supporting Qt 5.0.
Sadly, I wont be of any help, then, because I won't be the one to decide which *.h to use and where...
But your issue showed problems i still have in the code. Even if it compiles in some cases.
-
repo owner - changed status to resolved
Fixed issue
#546. Compile error under Windows in current develop revision.→ <<cset 37425da09774>>
-
That's exactly what I meant: you are l i g h t y e a r s ahead ;-) I would have never known that these small changes solve the whole thing! You're great, many thanks for that!
-
repo owner - removed version
Removing version: 0.5.0 (automated comment)
- Log in to comment
Again? 0_o I so tired of this problems with Path on Windows.