Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Link external code from folder C++
Link external code from folder C++ [message #1847404] Tue, 26 October 2021 09:48 Go to next message
Alvaro Casas is currently offline Alvaro CasasFriend
Messages: 1
Registered: October 2021
Junior Member
Hello,

I am new in Eclipse. I am try to create a project in C++, in this project, I have a .cpp which will use an external folder with code with .cpp and .h, so I need to link it and I do not how to do it. I got this error:

/usr/bin/ld: .//usr/bin/ld: ./src/Prueba.o: in function `main':
/root/soldierwf_prt_1/trunk/Prueba/Debug/../src/Prueba.cpp:17: undefined reference to `Pepe::hello()'
collect2: error: ld returned 1 exit status
make: *** [makefile:47: Prueba] Error 1src/Prueba.o: in function `main':
/root/soldierwf_prt_1/trunk/Prueba/Debug/../src/Prueba.cpp:17: undefined reference to `Pepe::hello()'
collect2: error: ld returned 1 exit status
make: *** [makefile:47: Prueba] Error 1


I tried this:

- File/import/File System/ and I choose my external folder
-Advance/ Checked : create links into workspace

The problem is that my code recognize the .h but when it builds the projects it can´t get the .o from my .cpp

(I insert a image of the IDE)
  • Attachment: Captura.PNG
    (Size: 220.84KB, Downloaded 54 times)
Re: Link external code from folder C++ [message #1847418 is a reply to message #1847404] Tue, 26 October 2021 16:41 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Is there a Pepe.cpp?
If so, it's not being compiled.
Where is it?

FWIW: You don't need that huge relative path in your include.
In fact, it's hard to get them right.

Just set the path to the code directory in
Project-->Properties--> C/C++ General --> Paths and Symbols --> Includes
and use #include "Pepe.h"
Previous Topic:How to calibrate a simulation without teleports
Next Topic:yaml-cpp
Goto Forum:
  


Current Time: Sat Apr 20 05:46:52 GMT 2024

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

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

Back to the top