我是一个模拟器,已经写了很多文件和头文件。问题在于,每当我包含文件时,我都会给出特定文件的相对路径。例如,我的应用程序中的典型代码将开始像这样:
我希望避免使用相对路径。例如,我想直接包含“tryskill.h”和“destination.h”,而不必给出绝对路径。这样,如果我更改任何特定文件的位置,就不需要担心。我正在使用Ubuntu 9.10。任何帮助将不胜感激。
#ifndef AI_H
#define AI_H
#include <cstdlib>
#include "../world/world.h"
#include "pathPlan.h"
#include "skills/tryskill.h"
#include "../info/condition.h"
#include "dataStructures/destination.h"
#include "../params/gamePlay.h"
#include "../modules/controlModule.h"
class ai
{
public:
etc etc
我希望避免使用相对路径。例如,我想直接包含“tryskill.h”和“destination.h”,而不必给出绝对路径。这样,如果我更改任何特定文件的位置,就不需要担心。我正在使用Ubuntu 9.10。任何帮助将不胜感激。
info/constants.h
和params/constants.h
?你可能想要设置一个基本的包含路径,例如/includes/
文件夹,但是任何在其下面的内容都应该作为包含的一部分进行指定。 - Amber