LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2015, 08:56 AM   #1
Shadew
LQ Newbie
 
Registered: Feb 2010
Posts: 5

Rep: Reputation: 0
C : Linking problem : can't find symbols in a library


Hello,

I'm trying to compile a code using functions located in a library (libxenctrl), but ld cannot find the symbols :
Code:
gntring3_read_async : gntring3_read_async.o
    gcc gntring3_read_async.o -lxenctrl /home/fremals/GVirtus9/modules/gntring/libgntring4.o -o ring3_read_async -lm
Code:
/home/fremals/GVirtus9/modules/gntring/libgntring4.o: in function « connect_ring »:
libgntring4.c:(.text+0x328): undefined reference to « xc_interface_open(xentoollog_logger*, xentoollog_logger*, unsigned int) »
libgntring4.c:(.text+0x348): undefined reference to « xc_map_foreign_pages(xc_interface_core*, unsigned int, int, unsigned long const*, int) »
libgntring4.c:(.text+0x365): undefined reference to « xc_interface_close(xc_interface_core*) »
collect2: error: ld returned 1 exit status
Code:
fremals@fremals-System-Product-Name:~$ nm /usr/local/lib/libxenctrl.so | grep xc_interface_open
0000000000016c39 T xc_interface_open
00000000000169a3 t xc_interface_open_common
fremals@fremals-System-Product-Name:~$ nm /usr/local/lib/libxenctrl.so | grep xc_interface_close
0000000000016d26 T xc_interface_close
0000000000016c8e t xc_interface_close_common
fremals@fremals-System-Product-Name:~$ nm /usr/local/lib/libxenctrl.so | grep xc_map_foreign_pages
000000000001e4a6 T xc_map_foreign_pages
Does soemone know why ld cannot find the symbols please ?

Thank you !!
 
Old 09-16-2015, 09:15 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Try putting -lxenctrl after /home/fremals/GVirtus9/modules/gntring/libgntring4.o
 
1 members found this post helpful.
Old 09-17-2015, 03:35 AM   #3
Shadew
LQ Newbie
 
Registered: Feb 2010
Posts: 5

Original Poster
Rep: Reputation: 0
The problem was solved : libgntring4 was compiled with g++ and gcc was therefore searching for c++ functions. Thanks for your help !
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'nm' lists all symbols - including static library symbols painulyarun Programming 4 04-06-2010 04:04 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 1 03-03-2007 07:46 PM
ld can't find library during linking kvtournh Programming 2 02-22-2007 04:47 PM
strange linking error -- can not find shared library George2 Programming 1 07-10-2006 11:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration