Page 1 of 1
floating point in msvc++
Posted: Tue Feb 12, 2008 5:41 pm
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!)
Posted: Tue Feb 12, 2008 6:07 pm
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
Posted: Tue Feb 12, 2008 11:09 pm
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
![Wink ;)](./images/smilies/icon_wink.gif)
.
Posted: Wed Feb 13, 2008 3:37 am
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.
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.
Posted: Wed Feb 13, 2008 4:09 am
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
Posted: Wed Feb 13, 2008 5:14 am
by wndproc
Thanks for those links. I got some code using floats running now without default libs and with
I am really suprised seeing this threat on gamedev.
I guess I'll have to increase my googling skills
![Wink :wink:](./images/smilies/icon_wink.gif)