LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-24-2003, 05:25 AM   #1
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Rep: Reputation: 15
Lightbulb Can you compile using g++? I need your help!!


Hi mates! I' m sure that my error it's a silly thing but these kind of errors are what usually drive us mad. So, the thing is that I can compile a file in my university but when I use exactly the same command in my computer, I get an errorr. The command and its output are:

[bash#] g++ LBPROT.cpp ./scope-src/libscope.a
/tmp/ccYYTJfA.o(.text+0x27): In function `getimagef(char*, image_data*)':
: reference to `getimage(data*, char*, char*)' non-defined
collect2: ld returned the output state 1

This is exactly the same error I get in my university when I omit the library file 'libscope.a' where 'getimagef' function is defined.

Any suggestion?


Thanks to all of you for your help!!
 
Old 07-24-2003, 05:33 AM   #2
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
This is not the way to include a library,if you are doing it you have to add -l<library name>
read the manpage,first.
 
Old 07-24-2003, 06:11 AM   #3
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Original Poster
Rep: Reputation: 15
Well rch, firstly thanks for your help. However, it doesn't work even in my university. I get that error:


Using relative path:

bash-2.04$ g++ -l ./scope-src/libscope.a LBPROT.cpp
/usr/bin/ld: cannot find -l./scope-src/libscope.a
collect2: ld returned 1 exit status


Using absolute path:

bash-2.04$ g++ -l /u1/msc/cl13/private/Project/scope-src/libscope.a LBPROT.cpp
/usr/bin/ld: cannot find -l/u1/msc/cl13/private/Project/scope-src/libscope.a
collect2: ld returned 1 exit status


Any alternative suggestion?? It's very important to compile that in my computer, since I'm wasting a lot of time in my project with this stupid thing...

Thanks to all for your help!!
 
Old 07-24-2003, 06:23 AM   #4
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
do you have the administrative previlage,
if you have maybe you could install the library
and then do ldconfig
The other way is to include the path using -L option
so do this
g++ -lscope -L<whereever the library is> -o <object file name> filename.cxx
 
Old 07-24-2003, 06:23 AM   #5
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
If ld can't find it, it ain't there :-)

Double check the path you're using.
 
Old 07-24-2003, 06:23 AM   #6
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
note that it is not libscope but only scope
 
Old 07-24-2003, 06:46 AM   #7
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Original Poster
Rep: Reputation: 15
Sorry mates, but it doesn't work yet. Just in case this might help you:

At home:
[bash$] g++ --version
g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

In my university:
bash-2.04$ g++ --version
2.96

I did that:

bash-2.04$ g++ -lscope -L /u1/msc/cl13/private/Project/scope-src/ -o libscope.a LBPROT.cpp
/usr/bin/ld: cannot find -lscope
collect2: ld returned 1 exit status

and that:

bash-2.04$ g++ -lscope -L /u1/msc/cl13/private/Project/scope-src/ -o object.o LBPROT.cpp
/usr/bin/ld: cannot find -lscope
collect2: ld returned 1 exit status

Does anybody know why I can do 'g++ LBPROT.cpp ./scr-scope/libscope.a -o LPPROT' but I can do neither ''g++ LBPROT.cpp -L ./src-scope/ -l libscope.a -o LBPROT' nor 'g++ LBPROT.cpp -l./src-scope/libscope.a -o LBPROT'???

Of course, none works at home...

Thanks!
 
Old 07-24-2003, 06:56 AM   #8
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
this is wrong
Quote:
bash-2.04$ g++ -lscope -L /u1/msc/cl13/private/Project/scope-src/ -o libscope.a LBPROT.cpp
do
bash-2.04$ g++ -L/u1/msc/cl13/private/Project/scope-src/ -o anything LBPROT.cpp -lscope
or much easier
copy libscope.a to /usr/lib
(if you are allowed to do so)
do ldconfig
now do not use the -L option
 
Old 07-24-2003, 07:38 AM   #9
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Original Poster
Rep: Reputation: 15
Amazing mate! It' works only in my university:

g++ -L./scope-src/ -o anything LBPROT.cpp -lscope

I've tried to copy the libscope.a file in /usr/lib and then do 'ldconfig'. Afterwards, I did 'g++ -o anything LBPROT.cpp -lscope' and 'g++ LBPROT.cpp ./scope-src/libscope.a -o LBPROT' that both work in my university, but any of them work at all in my laptop!!

Is there anything else I can do if have run your pacience out??

Thanks!!
 
Old 07-24-2003, 07:44 AM   #10
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
First tell me whether you are in the uni or at home,coz it appears that you are in two places at once.Or is it that your home is quite near the uni.(Incidentally I also study
in a uni,but my home is around 30km away)
Second apparently something did not worked and something worked,I do not follow what command worked and what didn't?
 
Old 07-24-2003, 07:47 AM   #11
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Original Poster
Rep: Reputation: 15
Well, I'm at home but I can compile my project from home via SSH. That's what I'm doing since the beggining of this 'conversation'.

See you around mate!
 
Old 07-24-2003, 08:31 AM   #12
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
well you could have said so,anyway i use ssh too within the uni only.
 
Old 07-24-2003, 08:39 AM   #13
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
finally about the commands which worked and which did not work could you tell me what they were?
 
Old 07-24-2003, 08:49 AM   #14
Musikolo
Member
 
Registered: Jul 2003
Distribution: Arch Linux x64
Posts: 115

Original Poster
Rep: Reputation: 15
All commands the work were in my university. The rest are divided between at home and university computes. I've already specified which didn't work in my univeristy... At home none worked...

Thanks mate! :d
 
Old 07-24-2003, 09:40 AM   #15
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
Is there anything else I can do if have run your pacience out??
My guess you are from Australia!
Anyway thanks!!
 
  


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
How do I compile? icecream33 Programming 3 12-20-2017 11:49 AM
compile 2.6.13 jupiter3437 Linux - Software 3 09-09-2005 04:09 PM
ntop compile/post-compile problem? tjb Linux - Software 3 12-28-2004 04:22 PM
Cannot compile c davidtsl Programming 8 12-13-2004 01:36 AM
Compile help Twiggy794 Linux - Software 1 12-03-2003 01:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:33 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