Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to build files that are referenced via links?(On building a project it says "No such file or directory" for e.g. a linked header)
icon5.gif  How to build files that are referenced via links? [message #682552] Sat, 11 June 2011 12:23 Go to next message
Silvestro Fantacci is currently offline Silvestro FantacciFriend
Messages: 1
Registered: June 2011
Junior Member
I am trying to build a project that contains links to external files but the builder does not seem to be able to find them.

Here is an example:

- Start Eclipse/CDT
- Create projects P1 and P2
- In project P2 create C++ Header File sample.h
- Select the P1/src folder (where the P1.cpp file with main is)
- Select New -> Other -> General -> File
- Click Advanced and tick "Link to file in the file system"
- Click Variables, select WORKSPACE_LOC and click Extend
- Browse and select P2/sample.h
- Now the C/C++ Projects tab shows the link to sample.h right next to P1.cpp
- Edit P1.cpp and add the line: #include "sample.h"
- Try to build project P1
- It says:

Quote:
make all
Building file: ../src/P1.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/P1.d" -MT"src/P1.d" -o"src/P1.o" "../src/P1.cpp"
../src/P1.cpp:11:20: error: sample.h: No such file or directory
make: *** [src/P1.o] Error 1


Is there a way to have sample.h provided to g++, other than giving up on links and copy (duplicate) the P2/src/sample.h file into the P1/src folder?
Re: How to build files that are referenced via links? [message #683762 is a reply to message #682552] Tue, 14 June 2011 11:41 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
See http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.cdt.doc.user/tasks/cdt_t_proj_referenced_configs.htm
You should export the include paths from project P1. This way, project P2 can simply use all the header files in P1.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:stdio.h
Next Topic:pngwrite
Goto Forum:
  


Current Time: Fri Sep 20 17:09:40 GMT 2024

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

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

Back to the top