编译器找不到我的标题? [英] Compiler Can't Find My Header?

查看:206
本文介绍了编译器找不到我的标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管hash包括它,我的项目似乎找不到它的头文件。我添加了屏幕截图,因为我认为这是展示我的问题的最有效的方法:

Despite hash-including it, my project cannot seem to find its header file. I have included a screenshot because I think it's the most effective way to showcase my problem:

错误信息

1> c:\users\wood\desktop\old programs\locker.cpp(2):致命错误C1083:无法打开包含文件:'Locker.h':没有档案或目录

1>c:\users\wood\desktop\old programs\locker.cpp(2): fatal error C1083: Cannot open include file: 'Locker.h': No such file or directory

有什么想法,什么问题?我试过:1)清理项目并重建它。 2)创建一个全新的,相同的项目。

Any ideas as to what's gone wrong? I've tried: 1) Cleaning the project and rebuilding it. 2) Creating a brand new, identical project.

谢谢!

推荐答案

程序的源代码位于C:\Users\Chuck\desktop\programming,但它需要一个头文件从C:\Users\Chuck\desktop\headers。我可以#include标题所有我想要的,但如果我不包括绝对文件名,编译器将拒绝看正确的地方。

但是,你可以尝试的最简单的解决方案是包括头文件的绝对路径。所以如果它位于

Ok, so let's say I have a program with source code located in C:\Users\Chuck\desktop\programming, but it requires a header file from C:\Users\Chuck\desktop\headers. I can #include the header all I want, but if I don't include the absolute file name, the compiler will refuse to look in the right place.
With you, however, the easiest solution you might try would be to include the absolute path to the header file. So if it's located at

    C:\Users\Wood\desktop\old programs\locker.h

你可以尝试包括而不是简单的locker.h

Code :: Blocks得到真正的fidgety与我,如果我不包括头文件同一目录。通常我可以解决这个使用相同的方法。尝试一下,看看是否有效。

you might try including that instead of simply "locker.h"
Code::Blocks gets real fidgety with me if I don't include the header file in the same directory. Normally I can work around that using this same method. Try it, see if it works.

这篇关于编译器找不到我的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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