Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Linker: undefined reference to `GPIOClass::~GPIOClass()'(This is happen if I try to link a static library)
Linker: undefined reference to `GPIOClass::~GPIOClass()' [message #1737055] Tue, 05 July 2016 11:26 Go to next message
Kurt Struevy is currently offline Kurt StruevyFriend
Messages: 45
Registered: May 2016
Member
Hello to all,
first of all: I would like to give a big compliment to all of the Eclipse developers. They do a great job: Smile
I'm sorry, but have a small problem. But I have no Idea what's the reason for this error.
I try to link some different libraries to my project. Each of this libraries is located in a separate project for static libraries.
The call for the linker is as follows:
arm-linux-gnueabihf-g++ -L"/home/kurt/workspace/GPIOClass/Debug" -L"/home/kurt/workspace/StepperMotor/Debug" -L"/home/kurt/workspace/TimerClass/Debug" -o "Teleskopsteuerung"  ./Teleskopsteuerung.o   -lrt -lGPIOClass -lStepperMotor -lTimerClass


Then I get this error messages:
/home/kurt/workspace/StepperMotor/Debug/libStepperMotor.a(StepperMotor.o): In function `signal_callback_handler(int)':
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:43: undefined reference to `GPIOClass::~GPIOClass()'
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:44: undefined reference to `GPIOClass::~GPIOClass()'
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:45: undefined reference to `GPIOClass::~GPIOClass()'
makefile:44: recipe for target 'Teleskopsteuerung' failed
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:46: undefined reference to `GPIOClass::~GPIOClass()'
/home/kurt/workspace/StepperMotor/Debug/libStepperMotor.a(StepperMotor.o): In function `StepperMotor::initGPIO()':
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:60: undefined reference to `GPIOClass::setdir_gpio(std::string)'
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:61: undefined reference to `GPIOClass::setdir_gpio(std::string)'
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:62: undefined reference to `GPIOClass::setdir_gpio(std::string)'
/home/kurt/workspace/StepperMotor/Debug/../StepperMotor.cpp:63: undefined reference to `GPIOClass::setdir_gpio(std::string)'


And more....

Sorry! I missed to tell some of my system:
I run Hyper-V (Debian) on Windows10
Eclipse Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600
And using the GCC compiler and linker for remote development.

[Updated on: Tue, 05 July 2016 11:59]

Report message to a moderator

Re: Linker: undefined reference to `GPIOClass::~GPIOClass()' [message #1737123 is a reply to message #1737055] Tue, 05 July 2016 22:38 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
This is a problem using the linker and not CDT or Eclipse.

The libraries are position dependent. I would guess GPIOClass::~GPIOClass( ) is in libGPIOClass which you told the linker to search before searching libStepperMotor and something within libStepperMotor has a reference to libGPIOClass.

You want to organize the searches so that the users of a function (.o and other libs) come before the library containing the function code. You probably should place libGPIOClass after libStepperMotor.

There is also a way to get the loader to search libraries repeatedly ( -( , I think).
ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html#SEC3
Oddlly, this is different: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

[Updated on: Wed, 06 July 2016 00:42]

Report message to a moderator

Previous Topic:unresolved external during link
Next Topic:Cannot create arduino project (Neon)
Goto Forum:
  


Current Time: Sat Apr 27 00:13:14 GMT 2024

Powered by FUDForum. Page generated in 0.03328 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top