473,769 Members | 5,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error, conflicting types

Hi,

I got this error and donno know how to fix it:

In file included from ../except.h:53,
from group.c:22:
.../portspecs.h:81: error: conflicting types for `const double
__infinity'
/usr/include/math.h:26: error: previous declaration as `const __dmath
__infinity[]'

Thanks!

Jul 22 '05 #1
6 8117
user wrote:
I got this error and donno know how to fix it:

In file included from ../except.h:53,
from group.c:22:
../portspecs.h:81: error: conflicting types for `const double
__infinity'
/usr/include/math.h:26: error: previous declaration as `const __dmath
__infinity[]'


Find out which '__infinity' you actually want and try not to include the
header that contains the other one. If you don't use either, and still
need both headers (math.h and portspecs.h), try placing one of them or
both in a namespace.

Both seem non-standard, and are probably compiler-specific, so consider
asking in a newsgroup dedicated to your compiler as well.

V
Jul 22 '05 #2

I need both headers (math.h and portspecs.h), and I'm using the
declaration of the one in portspecs.h.
One thing I guess I can do is to modify or remove that declaration in
math.h. But is there any other method I can keep math.h untouched, and
do minimum change to other files as well?
Thanks!

Jul 22 '05 #3
user wrote:
I need both headers (math.h and portspecs.h), and I'm using the
declaration of the one in portspecs.h.
One thing I guess I can do is to modify or remove that declaration in
math.h. But is there any other method I can keep math.h untouched, and
do minimum change to other files as well?


Yes. You could surround the inclusion of 'math.h' or the other one with

#define __infinity whatever_you_wa nt
#include <math.h>
#undef __infinity

which will cause the preprocessor to replace all __infinity occurrences
with whatever_you_wa nt, which will prevent the conflict. Play with this
method to find the suitable combination of macro/inclusion.

V
Jul 22 '05 #4
* Victor Bazarov:
user wrote:
I need both headers (math.h and portspecs.h), and I'm using the
declaration of the one in portspecs.h.
One thing I guess I can do is to modify or remove that declaration in
math.h. But is there any other method I can keep math.h untouched, and
do minimum change to other files as well?


Yes. You could surround the inclusion of 'math.h' or the other one with

#define __infinity whatever_you_wa nt
#include <math.h>
#undef __infinity

which will cause the preprocessor to replace all __infinity occurrences
with whatever_you_wa nt, which will prevent the conflict. Play with this
method to find the suitable combination of macro/inclusion.


(Discrete harking.) [math.h] is a standard header. Using macros that way
may conflict with implementation files. It may be that [portspecs.h] has
a conditional definition of __infinity, and that's worth checking out.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #5
"Alf P. Steinbach" <al***@start.no > wrote...
* Victor Bazarov:
user wrote:
> I need both headers (math.h and portspecs.h), and I'm using the
> declaration of the one in portspecs.h.
> One thing I guess I can do is to modify or remove that declaration in
> math.h. But is there any other method I can keep math.h untouched, and
> do minimum change to other files as well?


Yes. You could surround the inclusion of 'math.h' or the other one with .. ^^^^^^^^^^^^^^^ ^
#define __infinity whatever_you_wa nt
#include <math.h>
#undef __infinity

which will cause the preprocessor to replace all __infinity occurrences
with whatever_you_wa nt, which will prevent the conflict. Play with this
method to find the suitable combination of macro/inclusion.


(Discrete harking.) [math.h] is a standard header. Using macros that way
may conflict with implementation files. It may be that [portspecs.h] has
a conditional definition of __infinity, and that's worth checking out.


It may be so, or it may not be so.

A hack is a hack, whether it's applied to a header shipped with the
language/library implementation or a header shipped with a third-party
library. It is possible that tweaking the third-party header is safer.
It is also possible that it's less safe.

V
Jul 22 '05 #6
On 11 Jan 2005 14:46:52 -0800, "user" <b8*******@yaho o.com> wrote:
Hi,

I got this error and donno know how to fix it:

In file included from ../except.h:53,
from group.c:22:
../portspecs.h:81: error: conflicting types for `const double
__infinity'
/usr/include/math.h:26: error: previous declaration as `const __dmath
__infinity[]' This __infinity comes from math.h. Perhaps it might be better to use
cmath if that is possible. Just change:
#include <math.h>
to
#include <cmath>
if that is possible within your own code.

rossum

Thanks!


--

The ultimate truth is that there is no Ultimate Truth
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1665
by: Jan | last post by:
While building PHP 4.4.0 on a fresh installed FreeBSD 5.4 I get the following error: www# /bin/sh /usr/home/c/console/toolscon/web/2/php-4.4.0/libtool --silent --preserve-dup-deps --mode=compile gcc -Imain/ -I/usr/home/c/console/toolscon/web/2/php-4.4.0/main/ -DPHP_ATOM_INC -I/usr/home/c/console/toolscon/web/2/php-4.4.0/include -I/usr/home/c/console/toolscon/web/2/php-4.4.0/main -I/usr/home/c/console/toolscon/web/2/php-4.4.0...
10
3199
by: .J.T. | last post by:
Hello all, I have a strange error when try to use map<int, string> (using gcc version 2.95.2). I have this code in header file (display_map.h): #ifndef DISPLAY_MAP_H #define DISPLAY_MAP_H #include <map>
3
1629
by: Jeremy Beasley | last post by:
I'm having a problem using pointers to structures. One method of declaring point and then referencing a structure works, while the other generates an error at compile time. ----------------- ex1. (this method works) struct data { int a,b; } myData;
8
9313
by: Lathe_Biosas | last post by:
Hi While compiling my application that needs "windows.h" there are some typedef redefinition errors redefinition at winnt.h( line 207) typedef void *HANDLE redefinition at windef.h( line 143) typedef unsigned char BYTE redefinition at windef.h( line 141) typedef unsigned long DWORD #define INVALID_HANDLE_VALUE -1 redefinition at winbase.h(55) #define
5
4025
by: Jay A. Moritz | last post by:
Error: The dependency '<my dll>' in project '<my project>' cannot be copied to the run directory because it would conflict with dependency '<my dll>'. I am getting a dependency error building my application that was using some other namespaces that I had built and incorrectly referenced to the dll instead of the project, but I ended up removing the reference entirely but my project keeps getting the error. How do I tell my project to...
4
2358
by: fatboySudsy | last post by:
Hi, I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. Here are the error codes and underneath i have listed the program. Thanks in advance for looking. client.c: In function `main': client.c:118: error: syntax error before '-' token client.c: At top level: client.c:132: error: conflicting types...
1
1397
by: Gavin Chen | last post by:
Hello, I tried to install Tk400.200 on SunOS 4.1.4. At "make" time, I got the error message as below: cd pTk; make -e syntax OK -e syntax OK -e syntax OK -e syntax OK -e syntax OK -e syntax OK cd xpm; make libXpm.a
1
2008
by: Owen Zhang | last post by:
I am trying to build lxml package in SunOS 5.10. I got the following errors. Does anybody know why? $ python setup.py build Building lxml version 2.1. NOTE: Trying to build without Cython, pre-generated 'src/lxml/ lxml.etree.c' needs to be available. Using build configuration of libxslt 1.1.7 Building against libxml2/libxslt in the following directory: /usr/lib running build
2
1379
by: Tony Johansson | last post by:
Hello! I have a very simple example below. The problem is that I get the following compile error Error 1 Cannot implicitly convert type 'System.Reflection.MemberInfo' to 'MemberInfo' F:\C#\ConsoleApplication12\ConsoleApplication12\MemberInfo.cs 27 46 ConsoleApplication12 I can't understand why I get this compile error because according to the documentation it should work.
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.