i have the MINGW gcc 4.5.1. compiler installed in C:\MINGW and U++ installed in C:\UPP
i am running Microsoft Windows 7 Enterprise edition
when i try to compile anything i get this
now, with this change, I get the following linker error:
Linking...
c:/programs/upp/out/finesce/Core/MINGW.Alu.Debug.Shared.Standalone\parser.o: In function `ZN3Upp7CParser10ReadDoubleEv':
c:/programs/upp/uppsrc/Core/parser.cpp:245: undefined reference to `Upp::_clearfp()'
c:/programs/upp/uppsrc/Core/parser.cpp:268: undefined reference to `Upp::_clearfp()'
collect2.exe: error: ld returned 1 exit status
There were errors. (0:04.68)
I also tried to put the definitions outside the Upp namespace but still get an undefined reference error.
In the meantime I have installed TDM-GCC-64 and the linking step finishes successfully, but only after I have moved your proposed lines to above the
NAMESPACE_UPP
declaration in parser.cpp.
The linker gives an error in case your defines are located right before the ReadDouble() method (like it is in the current SVN version). The problem is that the linker tries to resolve Upp::_clearfp() which is not located in any library.
So we should move your proposed defines to the top of parser.cpp.
I was worried about this and finally got the source of the problem. See this link:
"Both mingw and gcc have a float.h. The mingw version supplements the gcc version, declaring _clear87 and _control87 among other things. The mingw version has an #include_next which is meant to include the gcc version. This works only when the mingw include dir is first in the header search path, which may not be correct. When the header search list is ordered with the mingw include directory after the gcc's, a common symptom is that _clear87 and _control87 are undeclared."
So there are two solutions:
- To move the #include_next <float.h> from the mingw version into the gcc version of float.h
- To include this code in parse.cpp or directly in Core.h (see the added extern "C"):
__cdecl and extern "C" do not mean the same: While _cdecl refers to the “C” calling convention, extern "C" refers to the “C” naming convention.
extern “C” is used in C++ code to indicate that the function is “C” function and the compiler should not mangle function name.
Please confirm that you can compile and link successfully in both 32 and 64 bits. The linker will require the extern "C" as _clearfp() follows "C" naming.
mtdew3q Messages: 181 Registered: July 2010 Location: Upstate, NY (near Canada)
Experienced Member
Hi Koldo-
This patch applied to upp/uppsrc/core/parser.cpp is working on win 7 service pack 1. I didn't need to comment out any lines for it to work. It builds the ctrllib app fine. It works under TDM-gcc compiler suite.