且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

编译器找不到我的标题?

更新时间:2023-01-19 07:42:51

程序的源代码位于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.