#error : ERROR: Use of C runtime library internal header file. 这错误什么意思?
#include <time.h>
#include <..\crt\src\ctime.h> //我用的是 VS2005 ,其他编译器可能要还相对路径
#include <iostream>
using namespace std;
int main()
{
time_t biggest=0x7fffffffffffffffI64; //15 个 f
cout < <_MAX__TIME64_T < <endl;
return 0;
}
在 ctime.h 里有
#define _MAX__TIME64_T 0x793406fffi64 /* number of seconds from
00:00:00, 01/01/1970 UTC to
23:59:59. 12/31/3000 UTC */
但包含后编译出错:
#error : ERROR: Use of C runtime library internal header file.
MSDN 上是这么解释的:
The error messages include the argument token-string and are currently not subject to macro expansion. These directives are most useful for detecting programmer inconsistencies and violation of constraints during preprocessing. The following example demonstrates error processing during preprocessing:
#if !defined(__cplusplus)
#error C++ compiler required.
#endif
When #error directives are encountered, compilation terminates.
[解决办法]
不用去INCLUDE crt下面的东西,编译器会自动寻找原型对应的实现代码
[解决办法]
Kenmark(fenix) ( ) 信誉:100 Blog 2007-2-5 19:39:34 得分: 0
不用去INCLUDE crt下面的东西,编译器会自动寻找原型对应的实现代码
=================================================================
CRT的内部头文件是不能够被应用程序直接包含的。
[解决办法]
根本就不要去包含这个头文件。
[解决办法]
预编译的选项里加上_CRTBLD
[解决办法]
错误:使用C运行库内部文件
对于这个问题,如果仅仅是为了使用_MAX__TIME64_T的值
可以自己定义这个宏
#define _MAX__TIME64_T 0x100000000000i64 /* number of seconds from
00:00:00, 01/01/1970 UTC to
23:59:59. 12/31/2999 UTC */
至于为什么不能直接include引用,原因确实不知
[解决办法]
就是说,这个头文件是C运行库编写时内部使用的,而调用这个库的用户不应该包含这个头文件。所以为了避免用户错误包含这个头文件,头文件里面自己做了检查,添加了#error语句,来阻止用户自己包含这个头文件,正如现在楼主做的。
[解决办法]
#include <..\crt\src\ctime.h>
改成#include "..\\crt\\src\\ctime.h "
要么改成绝对路径哦~~~
#include "c:\\crt\\src\\ctime.h "
[解决办法]
肯定头文件内有什么特殊的 宏判断
而没有定义那个宏
[解决办法]
VC的编译器INCLUDE:
include文件夹是默认include目录,提供函数原型定义以及一些宏,常数
crt文件夹是include里面的库的实现文件,编译时,我们只要#include "..\include\ "下的文件就可以了,就是只要#include <iostream> 就可以了,不要去#include crt下面的东西,因为编译器会根据使用的原型库,自动编译实现文件,多次包含会出错