Eclipse CDT: How to reference 3rd party includes via a Relative path

前端 未结 4 2001
盖世英雄少女心
盖世英雄少女心 2020-12-31 06:31

I\'m new to Eclipse-CDT, setting up a new project for the first time. I\'m trying to reference Boost without hardcoding an absolute path.

I\'ve put boost in

4条回答
  •  没有蜡笔的小新
    2020-12-31 07:35

    When adding an include file path in the CDT project (Project Properties/C/C++ General/Paths and Symbols), there are 3 buttons to browse for a location:

    • Variables...
    • Workspace...
    • File system...

    If you press the Workspace... button, the path will be relative to the workspace/project. If you select the Variables... button, you'll get to incorporate variables such as ${WorkspaceDirPath}. The variables can also reference environment variables, which might be handy if you want a single install of boost to be referenced from projects that might reside anywhere on your machine.

    If you incorporate variables into the path, make sure the "Is a workspace path" option is checked - otherwise the variable seems to get evaluated when you press "OK" instead of staying a variable to be evaluated at build time.

提交回复
热议问题