Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » ctrllib.icpp there was errors
ctrllib.icpp there was errors [message #41396] Thu, 12 December 2013 02:06 Go to next message
sycam_inc is currently offline  sycam_inc
Messages: 1
Registered: December 2013
Junior Member
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



----- CtrlLib ( GUI GCC DEBUG DEBUG_FULL BLITZ WIN32 ) (1 / 9)
BLITZ: LabelBase.cpp Button.cpp Switch.cpp EditField.cpp Text.cpp LineEdit.cpp DocEdit.cpp ScrollBar.cpp HeaderCtrl.cpp ArrayCtrl.cpp MultiButton.cpp
PopupTable.cpp DropList.cpp DropChoice.cpp Static.cpp Splitter.cpp FrameSplitter.cpp SliderCtrl.cpp ColumnList.cpp Progress.cpp AKeys.cpp RichTextVi
ew.cpp Prompt.cpp Help.cpp DateTimeCtrl.cpp Bar.cpp MenuItem.cpp MenuBar.cpp ToolButton.cpp ToolBar.cpp ToolTip.cpp StatusBar.cpp TabCtrl.cpp TreeCtr
l.cpp DropTree.cpp DlgColor.cpp ColorPopup.cpp ColorPusher.cpp FileList.cpp FileSel.cpp FileSelUtil.cpp PrinterJob.cpp Windows.cpp Win32.cpp Gtk.cpp
TrayIconWin32.cpp TrayIconX11.cpp TrayIconGtk.cpp Update.cpp CtrlUtil.cpp LNGCtrl.cpp Ch.cpp
ChWin32.cpp
ChGtk0.cpp
ChGtk.cpp
CtrlLib.icpp

There were errors. (0:00.10)
Re: ctrllib.icpp there was errors [message #41415 is a reply to message #41396] Fri, 13 December 2013 13:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Hello Mirek

Now it is not possible to compile with MinGW due to a simple problem in parse.cpp function CParser::ReadDouble().

Just adding this before the function solves it:

#if defined(COMPILER_MINGW)
_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _clearfp (void);    
#define SW_OVERFLOW    0x00000004              
#endif

Added in Redmine here.


Best regards
Iñaki

[Updated on: Fri, 13 December 2013 13:08]

Report message to a moderator

Re: ctrllib.icpp there was errors [message #41448 is a reply to message #41415] Wed, 18 December 2013 15:48 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi,

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.

System: Win7 Enterprise x64, MINGW32, GCC-4.8.1

Regards
Matthias
Re: ctrllib.icpp there was errors [message #41449 is a reply to message #41448] Wed, 18 December 2013 17:42 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Hello Matthias

Please brute force check if "_clearfp" string is in some file in your mingw/lib folder, specially in libmsvcrt.a or in libcrtdll.a.

If yes, please try to include that lib in "WIN32 GCC" line here:

index.php?t=getfile&id=4375&private=0

by adding for example "msvcrt" or "crtdll" (without the lib in the beginning and the .a at the end).

Please report the results (good or bad) Smile.
  • Attachment: Cap.JPG
    (Size: 99.42KB, Downloaded 630 times)


Best regards
Iñaki

[Updated on: Wed, 18 December 2013 17:43]

Report message to a moderator

Re: ctrllib.icpp there was errors [message #41450 is a reply to message #41449] Wed, 18 December 2013 18:01 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi Koldo,

thanks for the quick reply.

I tried this, but with no success.

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.

Regards
Matthias
Re: ctrllib.icpp there was errors [message #41455 is a reply to message #41450] Thu, 19 December 2013 08:22 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Perfect Matthias

In my case I use TDM-GCC too Smile.


Best regards
Iñaki
Re: ctrllib.icpp there was errors [message #41610 is a reply to message #41455] Sun, 05 January 2014 16:04 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Hello Masu

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"):
#if defined(COMPILER_MINGW)
extern "C" {
	_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _clearfp(void);
}
#define SW_OVERFLOW    0x00000004              
#endif


Please check it and give your opinion. In my case it works with latest MinGW TDM 32 and 64 bits.


Best regards
Iñaki
Re: ctrllib.icpp there was errors [message #41643 is a reply to message #41610] Tue, 07 January 2014 14:45 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi Koldo,

yes, this works, too.

But I think we can leave out the
extern "C" { ... }
declarations since __cdecl already instructs the compiler to use C calling conventions (see http://msdn.microsoft.com/en-us/library/zkwh89ks%28v=vs.80%2 9.aspx).

So the following would be enough to include at the top of parser.cpp or even in Core.h:

#if defined(COMPILER_MINGW)
_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _clearfp(void);
#define SW_OVERFLOW    0x00000004              
#endif


It even builds correctly without __cdecl under my configuration.

Regards
Matthias
Re: ctrllib.icpp there was errors [message #41646 is a reply to message #41643] Tue, 07 January 2014 16:33 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Hello Masu

__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.


Best regards
Iñaki
Re: ctrllib.icpp there was errors [message #41664 is a reply to message #41646] Wed, 08 January 2014 11:31 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi Koldo,

compiling and linking for 64 bit architecture has been successful.
For 32 bit architectures I get another linker error already reported here:

http://www.ultimatepp.org/forum/index.php?t=msg&goto=355 00&&srch=prettyprinters#msg_35500

This seems to be unrelated to our problem discussed here.

In summary, the fix works for both archs 32 and 64 bit.

Regards
Matthias
Re: ctrllib.icpp there was errors [message #41666 is a reply to message #41396] Wed, 08 January 2014 13:28 Go to previous messageGo to next message
mtdew3q is currently offline  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.

THANKS for the cool patch!

Have a cool weekend,
jim

#if defined(COMPILER_MINGW)
extern "C" {
	_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _clearfp(void);
}
#define SW_OVERFLOW    0x00000004              
#endif
Re: ctrllib.icpp there was errors [message #41668 is a reply to message #41666] Wed, 08 January 2014 14:46 Go to previous message
koldo is currently offline  koldo
Messages: 3352
Registered: August 2008
Senior Veteran
Thank you.

Best regards
Iñaki
Previous Topic: How to install Upp under Ubuntu 12.04 from PPA
Next Topic: How can I make a menu item display in bold?
Goto Forum:
  


Current Time: Tue Mar 19 06:49:18 CET 2024

Total time taken to generate the page: 0.00887 seconds