Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing 3rd party Libraries using *relative* paths in Eclipse-CDT

what is the best practice to reference 3rd party C++ components (e.g. includes, libraries) using relative paths in Eclipse-CDT?

  • I'm trying to reference Boost and Google protobuf.
  • I've put them each in a folder in my workspace, e.g. /home/user/workspace/boost_1_39_9
  • I've added a reference to that folder under build settings in the project properties, BUT eclipse won't let me specify that path as relative to the workspace folder, I have to choose it using filesystem and specify an absolute path

thanks,

  • Alex
like image 378
Alex Black Avatar asked Jul 06 '09 23:07

Alex Black


2 Answers

Eclipse variables, such as ${workspace_loc} and ${project_loc} only work for things that are actually in the runtime Eclipse workspace. When you say you put them under the workspace in the filesystem, did you actually import the files into Eclipse (using new Project; or creating a linked folder in an existing project)?

If the files exist in the filesystem but not in Eclipse itself then Eclipse will only be able to access them with absolute paths.

BTW, CDT has variables of its own: ${WorkspaceDirPath} ${ProjDirPath} ${ProjName} which expand to the particular filesystem location.

like image 95
James Blackburn Avatar answered Sep 29 '22 10:09

James Blackburn


I'm not sure about paths for CDT build settings (not at my computer) but can't you use the workspace variable? Something like: ${workspace_loc}/boost_1_39_9

Edit: OK, I did some searching and found some information on those variables, here. I think what you want is: ${project_loc:/boost_1_39_0} ?

like image 23
RayOK Avatar answered Sep 29 '22 11:09

RayOK