473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to eliminate multiple declaration error for a symbol present inboth libs( without modifying libs)

Hi All,
I have two libs (libFirst.a and libSecond.a). Both libs contains a
common function func(). Now I want to link an application "app" with
these two libs as

gcc -o app libFirst.a libSecond.a app.c.

It gives( and it should ) multiple declaration error . Is there any
way to tell the linker which func() declaration it must select.

NOTE: app need to be linked two both these libs.

Thanks and regards,
Raman Chalotra.
Mar 25 '08 #1
1 1802
On Apr 7, 11:00 am, David Thompson <dave.thomps...@verizon.netwrote:
On Mon, 24 Mar 2008 21:21:09 -0700 (PDT), Raman

<ramanchalo...@gmail.comwrote:
I have two libs (libFirst.a and libSecond.a). Both libs contains a
common function func(). Now I want to link an application "app" with
these two libs as
gcc -o app libFirst.a libSecond.a app.c.
It gives( and it should ) multiple declaration error . Is there any
way to tell the linker which func() declaration it must select.

Small but important terminology point: multiple _definition_.

A _definition_ in C provides the actual entity (an object, commonly
called a variable, or a function), and having more than one for the
same external name is a problem. Although one that the C standard does
not require an implementation to detect; you are mildly lucky that
your implementation did.

A _declaration_ is _sometimes_ (also) a definition, but when it isn't,
it only describes something defined elsewhere. It is definitely OK to
have external declarations in different T.U.s for the same external
entity, and that's the only (direct) way you can share it; it is also
legal to have multiple (compatible) declarations for the same external
entity in one T.U, and sometimes convenient.

That said, others have addressed the substance of your question.

- formerly david.thompson1 || achar(64) || worldnet.att.net
Taken a note of my ignorance.

Thanks,
Raman Chalotra
Jun 27 '08 #2

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

Similar topics

0
1012
by: pmud | last post by:
Hi, An ASP.NET project has been DEPLOYED to the WEB SERVER. I modified one of the pages in the DEVELOPMENT SERVER & tried to replace the Existing page in the project (which has already been...
4
3027
by: ben | last post by:
why is it, in the below code, when there's a printf statement (the one commented with /* ****** */) the final for loop prints out fine, but without the commented with stars printf statement...
0
1111
by: Jeff Dockman | last post by:
Background: We needed the ability to create a templated web site that may change in layout from installation to installation. To accomplish this, we created a base Page class that all pages in...
1
1142
by: Larry Brown | last post by:
Hi, I know that I should not, but believe me I really have to do that: I'm developping an ASP.NET application with Visual Studio .NET 2003 installed on my workstation, on a server which is on a...
0
805
by: NetRacer | last post by:
hi all, i have the following piece of code: Property xyz As Object Get End Get Set(ByVal Value as Object)
8
12512
by: D & J G | last post by:
A VB6 program that I created has been installed on a wide range of computers and networks without any problems. Win 95, Win 98 and XP so far.. Occasionally, however, the function refuses to start...
8
4867
by: Ian | last post by:
Consider that I have a "non-extern" function that takes no parameters. Which of the following would be ANSI C90 compliant: void hello(void) { printf("Hello\n"); } or
0
1655
by: Steve Rainbird | last post by:
I am brand new to db2 so I may be doing something stupid here please excuse me if I am. I have downloaded and installed db2 9 express on my Windows xp system. I have created a table with 2...
1
1314
by: TRiggs | last post by:
A SQL database was restored over in error. A backup of the original database was not created prior to the restore. Is there anyway to recover this database?
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
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,...
0
7367
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...
0
7471
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...
1
5028
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...
0
3187
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
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.