LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I make g++ compile in floating point support even though I don't use it? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-make-g-compile-in-floating-point-support-even-though-i-dont-use-it-875024/)

micropanther 04-14-2011 11:46 AM

How do I make g++ compile in floating point support even though I don't use it?
 
One of those odd things I learned the hard way is that if you are writing a shared object (library/.so) and any programs that will link to that library uses floating point numbers, the library must be compiled as if it uses floating point numbers.

What that really means is, you need to declare at least one float in the source for the library or when the caller connects and tries to run code in the library, the process aborts. So, I end up putting a float pi (3.1415); in the code and getting an unused variable warning all the time.

There has to be a simpler way, some flag to pass to g++ that says, "include floating point support even if you don't really need to." Anyone know how to do this?

Wes

p.s. Gosh I hope I remembered this correctly. I encountered this problem doing a multi-platform build for Windows and Linux. This COULD be a VC++ problem that I just carried into Linux by using the same source.

lupusarcanus 04-14-2011 11:23 PM

What command are you using to compile?

Check out here. Maybe use 'Control + F' and look for 'float'.


All times are GMT -5. The time now is 01:52 AM.