Solved

VC6 math.h warning

Posted on 2000-03-20
5
2,009 Views
Last Modified: 2012-05-05
I'm compiling a library that uses math.h in just about every file (over 100).  When I compile, I get a warning in every file including math.h.  Here's the offending warning:

c:\program files\microsoft visual studio\vc98\include\math.h(124) : warning C4091: 'extern ' : ignored on left of 'double' when no variable is declared


Here's the offending lines of code with surrounding comments:

/* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
 * for a value returned in case of error by a number of the floating point
 * math routines
 */
#ifndef __assembler /* Protect from assembler */
_CRTIMP extern double _HUGE;
#endif  /* __assembler */

#define HUGE_VAL _HUGE

The _CRTIMP is the line...  I haven't investigated much, but it looks to have something to do with using math as a dll vs. statically linked.  I want to know how to make the warning go away without breaking my software (no longer externing when I should or something).  Disabling the warning with #pragma works, but I'm interested in whether or not I'm doing something wrong to cause this, or if it's a common deal that's broken in the VC6 header.
0
Comment
Question by:Floater
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 2637399
Have you done something that might have defined _HUGE?  or has it been defined by something?
0
 

Expert Comment

by:wardkd
ID: 2639170
Nietod is right. You need to search your sources for a line similar to

#define _HUGE

Are you mixing (old) sources which may have been used in a memory-model sensitive operating system -like MS-DOS or old Windows???
0
 

Author Comment

by:Floater
ID: 2640633
Ok, good call... there is a #define _HUGE in the graphics lib I'm using.  Is it going to cause problems for me if this goes before math.h?  It seems it will break the extern, but is it important?
0
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 2640762
You probably are okay--as long as you don't need to access that _HUGE double (and as long as no code in the .h files use the _HUGE double, which does not appear to be a problem.)

If ther are problems...

If the graphics lib hadn't used #define, but had instead defined a cosntant instead you could use namespaces to solve the conflict.  Unfortunately the pre-processor does not respoect namespace scope (or any scope) so that won't help.  An alternative would be to edit the graphics library's .h file and rename the _HUGE.  You can't change the_HUGE in math .h (if _HUGE is being used) because you need to link to a double with that name.
0
 

Expert Comment

by:wardkd
ID: 2643679
The definition of _HUGE in the graphics header sounds like it may even be redundant in this environment, assuming it's a throwback to memory models.

However, the declaration of _HUGE in math.h is used later on, and may be important.

If the definition of _HUGE in your graphics library IS memory model related, then the code that depends on it will still work so long as there is a symbol of that name in existence at compile time -ie the math.h one will do.

Take a look at the way it's defined in your graphics library and try to see where it's used. This would be the favourite for disabling. As an experiment, you could comment out this definition.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question