LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-20-2011, 12:39 PM   #1
BlackMagic
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
Unhappy /usr/bin/ld: /tmp/cc.... undefined reference collect2:ld returned 1 exit status


Hi,
I am really new to this.
I am solving LP problem using QSopt and having following error dont understand whats the problem

abc@ubuntu:~$ gcc -m32 -static -I/usr/include/QS -L/usr/include/QS -Iqsopt abc.c
/usr/bin/ld: /tmp/ccnStZg5.o: in function main:abc.c(.text+0x19): error: undefined reference to 'QSread_prob'
/usr/bin/ld: /tmp/ccnStZg5.o: in function main:abc.c(.text+0x4d): error: undefined reference to 'QSopt_primal'
/usr/bin/ld: /tmp/ccnStZg5.o: in function get_solutions:abc.c(.text+0xf6): error: undefined reference to 'QSget_colcount'
/usr/bin/ld: /tmp/ccnStZg5.o: in function get_solutions:abc.c(.text+0x108): error: undefined reference to 'QSget_rowcount'
/usr/bin/ld: /tmp/ccnStZg5.o: in function get_solutions:abc.c(.text+0x14e): error: undefined reference to 'QSget_colnames'
/usr/bin/ld: /tmp/ccnStZg5.o: in function get_solutions:abc.c(.text+0x1a6): error: undefined reference to 'QSget_rownames'
/usr/bin/ld: /tmp/ccnStZg5.o: in function get_solutions:abc.c(.text+0x278): error: undefined reference to 'QSget_solution'
/usr/bin/ld: /tmp/ccnStZg5.o: in function randomized_rounding:abc.c(.text+0x506): error: undefined reference to 'round_double'
collect2: ld returned 1 exit status
abc@ubuntu:~$

Any help is monsterously appreciated.

Thanks in advance.
 
Old 04-20-2011, 03:44 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Hi, welcome to LQ!

First thing I notice is that your -L statement also points
at include instead of lib. Fix that and see what happens ;}


Cheers,
Tink
 
Old 04-20-2011, 05:52 PM   #3
BlackMagic
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Ok I tried what you suggested now my usr/lib/QS folder has libqsopt.a file in it and i executed the following command but still the same thing. What am i doing wrong now?
abc@ubuntu:~$ gcc -m32 -static -I/usr/include/QS -L/usr/lib/QS -lqsopt abc.c
/usr/bin/ld: /tmp/ccwH2HNx.o: in function main:abc.c(.text+0x19): error: undefined reference to 'QSread_prob'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function main:abc.c(.text+0x4d): error: undefined reference to 'QSopt_primal'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function get_solutions:abc.c(.text+0xf6): error: undefined reference to 'QSget_colcount'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function get_solutions:abc.c(.text+0x108): error: undefined reference to 'QSget_rowcount'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function get_solutions:abc.c(.text+0x14e): error: undefined reference to 'QSget_colnames'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function get_solutions:abc.c(.text+0x1a6): error: undefined reference to 'QSget_rownames'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function get_solutions:abc.c(.text+0x278): error: undefined reference to 'QSget_solution'
/usr/bin/ld: /tmp/ccwH2HNx.o: in function randomized_rounding:abc.c(.text+0x506): error: undefined reference to 'round_double'
collect2: ld returned 1 exit status
abc@ubuntu:~$


I tried one more thing...and have new set of errors :'(

its now "i" capital in -I/usr/include/QS and small L in -lqsopt still nothing then have moved libqsopt.a to /usr/lib
I guess it has decided not to work for me at all.
These are some new addition.... :'(
abc@ubuntu:~$ gcc -m32 -I/usr/include/QS abc.c -lqsopt
/usr/bin/ld: /tmp/ccPPZ8Nt.o: in function randomized_rounding:abc.c(.text+0x506): error: undefined reference to 'round_double'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(util.o): in function ILLutil_our_frac:util.c(.text+0x1b8): error: undefined reference to 'floor'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(util.o): in function ILLutil_our_floor:util.c(.text+0x195): error: undefined reference to 'floor'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(util.o): in function ILLutil_our_ceil:util.c(.text+0x1a1): error: undefined reference to 'ceil'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(symtab.o): in function ILLsymboltab_uname:symtab.c(.text+0x1127): error: undefined reference to 'log10'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(presolve.o): in function ILLlp_scaleresolve.c(.text+0x57d): error: undefined reference to 'fabs'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(presolve.o): in function ILLlp_scaleresolve.c(.text+0x705): error: undefined reference to 'fabs'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(simplex.o): in function primal_phaseI_step:simplex.c(.text+0x1c32): error: undefined reference to 'fabs'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libqsopt.a(simplex.o): in function primal_phaseI_step:simplex.c(.text+0x1c65): error: undefined reference to 'fabs'

collect2: ld returned 1 exit status

Last edited by BlackMagic; 04-20-2011 at 06:16 PM. Reason: one more thing which tried.
 
Old 04-20-2011, 07:43 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,653

Rep: Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532Reputation: 2532
Assume QS.tar.gz ( The Redhat 8 version = The Linux version.)
http://www2.isye.gatech.edu/~wcook/q...ux24/QS.tar.gz

Example :
Code:
readelf -s qsopt.a | grep QSopt_primal
    18: 00000000   163 FUNC    GLOBAL DEFAULT    1 QSopt_primal
    47: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND QSopt_primal
You can try the same with the other symbols.
 
Old 04-20-2011, 08:44 PM   #5
BlackMagic
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Smile

Thanks alot you guys!! I got it tried adding -lm (small L) to the command args. Libm is the math library. Which was missing it seems its working fine for me now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] collect2: ld returned 1 exit status linuxpremi Linux - Newbie 3 01-30-2011 10:54 PM
Opencv error: /usr/bin/ld.real: cannot find -lcv; collect2: ld returned 1 exit status Ankithskarat Linux - Newbie 1 03-24-2010 12:03 AM
A different collect2: ld returned 1 exit status old_as_a_fossil Linux - General 0 01-28-2010 09:57 AM
collect2: ld returned 1 exit status kvijaik Linux - Software 2 10-07-2009 09:17 PM
collect2: ld returned 1 exit status abirami Linux - Software 0 03-02-2005 01:07 AM


All times are GMT -5. The time now is 05:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration