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
Solved

VC6 math.h warning

Posted on 2000-03-20
5
2,003 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  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 …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

792 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