?
Solved

VC6 math.h warning

Posted on 2000-03-20
5
Medium Priority
?
2,038 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 300 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

770 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