如何包含2个同名文件? [英] how to include 2 files with same name?

查看:55
本文介绍了如何包含2个同名文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu中工作,我有一个包含子文件夹的文件夹.在第一个文件夹中,我有一个name.h文件.在子文件夹中,我再次有一个name.h文件.问题是我需要两个标题.问题在于两个标头具有相同的名称.我收到错误消息,指出未在此范围内声明特定功能.如何解决这个错误?没有办法指定一个特定的方法,可变使用什么头?有办法解决这个问题吗?

I am working in ubuntu, I have a folder that contains a subfolder. in the first folder i have a name.h file. in subfolder i have again a name.h file. the thing is that i need both the headers. the problem is the fact that both headers have the same name. i receive errors saying that a specific function was not declared in this scope. how to resolve this error? isn't there a way to specifiy to a specific method, variable what header to use ? is there a way to resolve this problem?

推荐答案

所以,像这样的东西:

<some dir>
  -> <sub1>
       header.hpp
  -> <sub2>
       header.hpp

这可以通过告诉编译器在公共文件夹中搜索标头(在上述情况下)并包括如下内容来解决:

This is resolved by telling the compiler to search in the common folder for the headers (in the above case ) and including like this :

#include "sub1/header.hpp"
#include "sub2/header.hpp"

这篇关于如何包含2个同名文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆