Solved

VC6 math.h warning

Posted on 2000-03-20
5
1,975 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now