Solved

VC6 math.h warning

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

690 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