473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

g++ linking error: undefined reference

Hello everybody,

I'm trying to port a project from Windows+Cygwin to Linux(i'm working on a
Debian-like: Kubuntu), but I'm facing a lot of linking problems.

This project needs libraries xerces and gsl, more specifically libxerces-c,
libgsl, libgslblas. The project comes with an own makefile, automatically
generated by Eclipse cdt on Windows, on wich I made some change to fit it
for Linux.

Compilation step works fine, but when it tries to link tens of .o in an only
one binary, the following error occurs:

../src/utils/kinematic/Kinematics.o: In function
`Kinematics::getInvTransfMatrix(gsl_vector const*, unsigned int)':
Kinematics.cpp:(.text+0x8d): undefined reference to
`DirKin::getInvTransfMatrix(gsl_vector const*, unsigned int)'
collect2: ld returned 1 exit status
make: *** [Puma200CS.exe] Error 1

But the above function doesn't come from any libraries. It's ust user
defined, so it appears in Eclipse's code completion.

How can I get rid of that?

Here is the linker section of the makefile:

************************************************** **************
puma200CS: $(OBJS) $(USER_OBJS)
Â* Â* Â* Â* @echo 'Building target: $@'
Â* Â* Â* Â* @echo 'Invoking: GCC C++ Linker'
Â* Â* Â* Â* g++ -L/usr/lib $(LIBS) $(OBJS) $(USER_OBJS) -o puma200CS
Â* Â* Â* Â* @echo 'Finished building target: $@'
************************************************** **************

where $OBJS is a list of tens of .o and $LIBS
is "-lgslcblas -lgsl -lxerces-c", without quotes, of course. Libraries are
correctly installed in /usr/lib, as you can see by -L linker's flag.

I've read somewhere that it's, maybe, a linking order question. I tried to
change the linking order, but no way to work.

Thanks a lot, in advance.
--
Emanuele Torrenti
Linux engine 2.6.17-11-generic i686 GNU/Linux
Mar 29 '07 #1
2 5983
Hello,

Manuel T wrote:
g++ -L/usr/lib $(LIBS) $(OBJS) $(USER_OBJS) -o puma200CS
g++ -L/usr/lib $(OBJS) $(USER_OBJS) $(LIBS) -o puma200CS

Libs go always after the object files, and libs other libs depend before
them. If you have circular dependencies between libs you have to give
some twice.

The question belongs into gnu.gcc.help, and is a FAQ there, here
probably too.

Bernd Strieder

Mar 29 '07 #2
Bernd Strieder wrote:
Hello,

Manuel T wrote:
>g++ -L/usr/lib $(LIBS) $(OBJS) $(USER_OBJS) -o puma200CS

g++ -L/usr/lib $(OBJS) $(USER_OBJS) $(LIBS) -o puma200CS
Done, but same error...
The question belongs into gnu.gcc.help, and is a FAQ there, here
probably too.
Thanks a lot... Now I'm studying autoconf & automake(to do more portable
things). I'll post again when i fix all the stuff.

Bye
--
Linux engine 2.6.17-11-generic i686 GNU/Linux
Mar 29 '07 #3

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

Similar topics

0
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are...
1
by: Brian J. Ackermann | last post by:
Hi everybody, I'm new to c++, and I'm working on this simple little application, which ought to compile just fine, but I'm missing something. The program has 4 file, 2 headers, and 2 cpp files....
2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on...
1
by: Josep | last post by:
Hi, I've got the library libmysqld.lib which links under MS VC++ without problem. But when I try to compile the same files + lib with Dev-C++ I get the Linker Error below... What am I doing...
2
by: Terry Lee Tucker | last post by:
Let me explain: I have written a "C" function which contains calls to other functions, all of which work with an API to a mileage database product called PCMiler. These functions make...
3
by: walkeraj | last post by:
I'm trying to compile an open source game called IVAN , and I'm able to compile it from a makefile, but not from an IDE. I have attempted to recreate the way the makefile compiles the project as...
2
by: pssraju | last post by:
Hi, At present application was built on solaris 9 using sun studio 9 (Sun C++ 5.6) & rouguewave sorce pro 5. We are planning to port the same application onto SuSE Linux 9.5.0 using GCC 3.3.3 & RW...
3
by: PG | last post by:
I am trying to compile a simple ODBC and C example on Windows XP SP2. I have Cygwin_NT 5.1. This is the code (obtained from...
0
by: cresloga | last post by:
im trying a simple C program to create table in db2 database named sample. the 1st 4 steps are fine....precompile,bind,compilation are fine. but im getting the following error wen i try to link ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.