floating point in msvc++

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
wndproc
Posts: 20
Joined: Sat Feb 02, 2008 3:02 pm
Location: Austria

floating point in msvc++

Post by wndproc »

Hi again,
because it seems like noone else on earth has this problem (I googled for some time already), I'll just post. Please forgive me if thats just too easy and the nerd over there just doesn't get it.


So how can I update my runtime in MSVC++ to handle float's?

When I just use them like float abc = 1.0f; it gives me the error:
Error 3 error LNK2001: unresolved external symbol __fltused Main.obj


(Try searching for this in google. You will only get a few 1000 posts about how some guy lost his windows runtime support. It made me crazy!)
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

You went at great lengths to not get told to STFW, so I'm gonna tell you this:
You shouldn't say (more then once, or as something funny) that you can't find something on the web. If someone actually searches and doesn't find something then you're ok.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

First entry on a Google search for "__fltused": http://www.codeguru.com/forum/showthread.php?t=346998.

Try reading the thread instead of the first post ;).
wndproc
Posts: 20
Joined: Sat Feb 02, 2008 3:02 pm
Location: Austria

Post by wndproc »

You went at great lengths to not get told to STFW, so I'm gonna tell you this:
You shouldn't say (more then once, or as something funny) that you can't find something on the web. If someone actually searches and doesn't find something then you're ok.
I am sorry for getting too emotional in the first post. I do feel guilty about beeing the one who posts things like "how do I get floating points to work?" or "what's all this mov in my assembler code?". Maybe next time I'll post something I already know, just to look somewhat more professional.

pcmattman wrote:First entry on a Google search for "__fltused": http://www.codeguru.com/forum/showthread.php?t=346998.
I have actually gone through this one before, but I returned after I saw this line:
That happens if you compile either managed applications along with unmanaged libraries or if you disable the normal Visual C Runtime Library (CRT)...

Right click your project in the Project Explorer > Settings > Linker > Input >
Ignore Default Libs: No
This quote stands in conflict with the line I readed at BrokenThorns tutorial about setting up MSVC++:
Required Setting: Set Ignore all Default Settings to Yes (/NODEFAULTLIB).

Remember that we have no runtime library.
But anyway, I guess I'll try to turn /NODEFAULTLIB off. Maybe these default libraries are build-in libs which would be useable for my OS. Although I can't imagine that these libs, which 99% of the PE files use, are build in into all of them. They sound more like beeing implemented at runtime like kernel.dll or gdi32.dll.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

wndproc wrote:I have actually gone through this one before, but I returned after I saw this line:
However, the second link directs you to this exchange:
Diomedis wrote:
marlene wrote:In Interactive Systems 386/ix 2.0.2 there is a symbol used in many of the
routines in the C libraries called "__fltused". It is not in 386/ix 1.0.6.
When using the 'nm' command I see it being an external symbol of value 0
everywhere, but I never see where it is really defined. Can anybody tell me
its type and what it's used for?
It is used by the Microsoft languages to indicate that a floating point
library needs to be loaded. The symbol is declared as extern in all
code that uses floating point and is defined in the floating point
library. In this way it forces the library to be loaded when needed.
This is needed because of the way a comprocessor is emulated. A
program may be using floating point without having any external symbols
defined in a floating point library.
So perhaps you could define a variable called __fltused and set it to 0, and see what happens. Oh wait, this thread seems to imply it should be 1. Well, test them with both and see what happens.
But anyway, I guess I'll try to turn /NODEFAULTLIB off.
You could try, but it won't work. Many of these libraries will call Windows API calls, so unless you are planning on recreating ReactOS, you have to use the /NODEFAULTLIB switch.


JAL
wndproc
Posts: 20
Joined: Sat Feb 02, 2008 3:02 pm
Location: Austria

Post by wndproc »

Thanks for those links. I got some code using floats running now without default libs and with

Code: Select all

extern "C" int _fltused = 1;
I am really suprised seeing this threat on gamedev.
I guess I'll have to increase my googling skills :oops: :wink:
Post Reply