954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

duplicate symbol

During a C++ script compilation, and doing exe building in AIX 5.3 using xlC compiler, I get the warning shown below:

ld: 0711-224 WARNING: Duplicate symbol: .NotNode::NotNode(BoolNode*)
ld: 0711-224 WARNING: Duplicate symbol: .UnaryNode::UnaryNode(BoolNode*)
ld: 0711-224 WARNING: Duplicate symbol: .OrNode::OrNode(BoolNode*,BoolNode*)
ld: 0711-224 WARNING: Duplicate symbol: .BinaryNode::BinaryNode(BoolNode*,BoolNo
de*)
ld: 0711-224 WARNING: Duplicate symbol: .AndNode::AndNode(BoolNode*,BoolNode*)
ld: 0711-224 WARNING: Duplicate symbol: .LeafNode::LeafNode(const char*)
ld: 0711-224 WARNING: Duplicate symbol: .RegularExpression::RegularExpression(co
nst char*)
ld: 0711-224 WARNING: Duplicate symbol: .RegularExpression::Init(const char*)
ld: 0711-224 WARNING: Duplicate symbol: .UnaryNode::~UnaryNode()
ld: 0711-224 WARNING: Duplicate symbol: .UnaryNode::Dump(ostream&,int)
ld: 0711-224 WARNING: Duplicate symbol: .UnaryNode::Visit(int,void*)
ld: 0711-224 WARNING: Duplicate symbol: .BinaryNode::~BinaryNode()
ld: 0711-224 WARNING: Duplicate symbol: .BinaryNode::Dump(ostream&,int)
ld: 0711-224 WARNING: Duplicate symbol: .BinaryNode::Visit(int,void*)
ld: 0711-224 WARNING: Duplicate symbol: .StringDictionaryIterator::operator void
*()


The warning does not cause any problems in building EXE or during validation but too many warnings for building each EXE is annoying.

Can someone please help me on how to set the flag in Makefile so that this warning can be removed and build is done without this?

etc123
Light Poster
49 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

maybe you included the same header file more than once and left out the code guards.

Ancient Dragon
Retired & Loving It
Team Colleague
30,043 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

Is this valid?.. #pragma warning(disable:'warn code') ..:p

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

>Is this valid?.. #pragma warning(disable:'warn code') ..:p
If you don't know what's causing a warning, you'd be a fool to disable it. I only know of one warning, on any compiler that I've ever used, where I'm 100% sure that it can be safely disabled. The correct response to a warning is understanding it and then fixing it.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
>Is this valid?.. #pragma warning(disable:'warn code') ..:p If you don't know what's causing a warning, you'd be a fool to disable it. I only know of one warning, on any compiler that I've ever used, where I'm 100% sure that it can be safely disabled. The correct response to a warning is understanding it and then fixing it.


yep..I just trying to set the flag not to understand it and fix it..Maybe u can fix it.:p

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

>I just trying to set the flag not to understand it and fix it
Clearly. That's why I felt the need to tell you that disabling a warning without understanding it is the height of stupidity. You're not stupid, are you?

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Thank u very much sir..Don't know how to solve the problems sir..Could u tell us sir..:p

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

That attitude isn't likely to make you any friends.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

The problem could be the result of several different things, and no one can tell you specifically without seeing the code. Another possible cause, besides the ones I already mentioned previously, is putting the implementation code in a header file. In that case it will be duplicated in every *.cpp file that uses the header file, thus the duplicate error message(s). The solution is to put the implementation code in one *.cpp file, leaving only the class declaration in the header file.

Ancient Dragon
Retired & Loving It
Team Colleague
30,043 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 
That attitude isn't likely to make you any friends.


that's ok..I'm sorry..:)

cikara21
Posting Whiz
340 posts since Jul 2008
Reputation Points: 47
Solved Threads: 69
 

Assuming that the warnings are ok and they are arising out of so many different files, is there a way to supress them in the Makefile so that they dont pop up?

etc123
Light Poster
49 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

why not just fix the problem instead of trying to hide it.

Ancient Dragon
Retired & Loving It
Team Colleague
30,043 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

But is there a way?

etc123
Light Poster
49 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Probably -- I've already mentioned three things that you should look at. Could be one of them or none of them. But can't tell you if you don't post the code.

Ancient Dragon
Retired & Loving It
Team Colleague
30,043 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 
Assuming that the warnings are ok and they are arising out of so many different files, is there a way to supress them in the Makefile so that they dont pop up?


Consult the compiler documentation.

mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You