Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning -

Status
Not open for further replies.

unirams

Programmer
Dec 25, 2001
20
IN
Hi,

I am working on to remove warning messages in all my C,C++ files in both Sun and HP machines. When i compile my CPP program in Sun environment, it gives me the following warning.

"../src/CPUtils.cpp", line 26: Warning (Anachronism): Formal argument comp of type int(*)(const char*,const char*) in call to strToInt(const StrIntMap*, const RWCString&, int, bool, int(*)(const char*,const char*)) is being passed extern "C" int(*)(const char*,const char*).

To resolve the above warning, i just put extern C in front of my function. After that when i compiled the same program in Sun, its working fine. But it giving me the following warning in HI environment.

Warning 495: "../src/CPUtils.cpp", line 17 # The linkage directive is ignored for an object or function declared static.strToInt(const StrIntMap* map, const RWCString& str, int notFoun).

How would i proceed with this one. I have to solve this in both HP and Sun.

Can any one give me the solution will be greatly appreciated.

Thanks and regards,
Ram
 
A possible solution could be preprocessor directives but that could get tedious. Here is the approach



#ifdef _HP_SYSTEM_
#extern "C"
<hp function>
#else
// assume SUN SYSTEM
<sun function>
endif

The makefile should have 2 make commands... one for the regular make which should already exist and one for
makeHP which will have a DEFINE put into it to define _HP_SYSTEM_

Good luck, this will be a tedious task but this is the only way to approach it that I can think of.

Matt




 
Hi Matt,

Thanks for your response. It was really helpful to me to solve the one. But i am curious that whether we have any comiler option to solve those warning messages in HP platform.

Thanks and regards,
Ram
 
It has been a while since I worked on a Unix system but if I remember correctly, the compiler should have an option, maybe -W. Do a man on your compiler and see what you find. However, remember that turning off warnings does not get rid of them :)

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top