当包括头文件时,路径是否区分大小写? [英] When including header files, is the path case sensitive?

查看:2226
本文介绍了当包括头文件时,路径是否区分大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定此目录树:

  src / MyLibrary / MyHeader.h 
src / file.cpp $ b bb
p>

编译file.cpp使用VS,在gcc中失败。




    <
  • 最好的做法是将所有文件/文件夹名称保存为小写和/或小写。



感谢。

解决方案

大小写取决于操作系统。 Windows不区分大小写。 Linux是。



编辑:



实际上,如 Martin York 的注释,区分大小写取决于文件系统。默认情况下,Windows使用不区分大小写的文件系统,而Linux使用区分大小写的文件系统。对于谁有兴趣知道哪些文件系统是区分大小写,哪些不是,有一个完整的列表维基百科:文件名限制比较


Given this directory tree:

src/MyLibrary/MyHeader.h
src/file.cpp

file.cpp:

#include "mylibrary/myheader.h"
...

Compiling file.cpp works with VS, fails in gcc.

  • What does the standard say?
  • If the path is case sensitive, why is this wise?
  • What's the best practice, keep all file/folder names lowercase and thus do the same when including?

Thanks.

解决方案

The case sensitivity depends on the Operating System. Windows is not case sensitive. Linux is.

EDIT:

Actually, as observed by Martin York's comment, the case sensitivity depends on the file system. By default Windows uses a case insensitive file system, while Linux uses a case sensitive one. For whoever is interested to know which file systems are case sensitive and which aren't, there is a comprehensive list on Wikipedia: Comparison of file name limitations.

这篇关于当包括头文件时,路径是否区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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