Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Issue while linking shared library: (7 Items)
   
Issue while linking shared library  
I have created two projects,
1. Library project that creates libXYZ.so and libXYZS.a using momentics 6.5.0 IDE.
2. Application project that uses the above shared library.

I am getting the following error when I compile the application project(I have linked the shared library using -lXYZ 
option to qcc),

undefined reference to `Function_ABC'

I have the following queries,
1. How to link the shared library to the application ?
2. How to resolve the undefined reference error ?
Re: Issue while linking shared library  
Where this function suppose to be defined? In the library? Do you have 
only one library?
Do you have any other errors during compilation? Are you mixing c and c++?
On 16/11/2010 1:26 AM, Girisha SG wrote:
> I have created two projects,
> 1. Library project that creates libXYZ.so and libXYZS.a using momentics 6.5.0 IDE.
> 2. Application project that uses the above shared library.
>
> I am getting the following error when I compile the application project(I have linked the shared library using -lXYZ 
option to qcc),
>
> undefined reference to `Function_ABC'
>
> I have the following queries,
> 1. How to link the shared library to the application ?
> 2. How to resolve the undefined reference error ?
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post74750
>
Re: Issue while linking shared library  
Yes, this function suppose to be defined in the library.
Yes I have only one library
No, I dont have any other compilation errors.
No I am not mixing C and C++, I am using only C.
Re: Issue while linking shared library  
That should have just worked
- check the spelling
- make sure your function is not static
- make sure library is picked up from where you want (and you not linking some old variant which does not have this 
function)


On 16/11/10 08:09 AM, Girisha SG wrote:
> Yes, this function suppose to be defined in the library.
> Yes I have only one library
> No, I dont have any other compilation errors.
> No I am not mixing C and C++, I am using only C.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post74765
> 
Re: Issue while linking shared library  
Hey sorry for the confusion, it did work !!!
Re: Issue while linking shared library  
Hi, Girisha,

Did you tell the linker where to find libXYZ with a -L option?  e.g.,
-L/path/to/libXYZ/project

HTH,

Christian


On 10-11-16 1:26 AM, "Girisha SG" <community-noreply@qnx.com> wrote:

> I have created two projects,
> 1. Library project that creates libXYZ.so and libXYZS.a using momentics 6.5.0
> IDE.
> 2. Application project that uses the above shared library.
> 
> I am getting the following error when I compile the application project(I have
> linked the shared library using -lXYZ option to qcc),
> 
> undefined reference to `Function_ABC'
> 
> I have the following queries,
> 1. How to link the shared library to the application ?
> 2. How to resolve the undefined reference error ?
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post74750
> 
> 

-- 
Christian W. Damus
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>; 

Re: Issue while linking shared library  
If it is not in the path it should have produced an error...
Btw make sure -lXYZ is at the END of the command line, AFTER object files.

On 16/11/10 08:19 AM, Christian Damus wrote:
> Hi, Girisha,
> 
> Did you tell the linker where to find libXYZ with a -L option?  e.g.,
> -L/path/to/libXYZ/project
> 
> HTH,
> 
> Christian
> 
> 
> On 10-11-16 1:26 AM, "Girisha SG" <community-noreply@qnx.com> wrote:
> 
>> I have created two projects,
>> 1. Library project that creates libXYZ.so and libXYZS.a using momentics 6.5.0
>> IDE.
>> 2. Application project that uses the above shared library.
>>
>> I am getting the following error when I compile the application project(I have
>> linked the shared library using -lXYZ option to qcc),
>>
>> undefined reference to `Function_ABC'
>>
>> I have the following queries,
>> 1. How to link the shared library to the application ?
>> 2. How to resolve the undefined reference error ?
>>
>>
>>
>>
>> _______________________________________________
>>
>> General
>> http://community.qnx.com/sf/go/post74750
>>
>>
>