简体   繁体   English

dirent.h的代码在哪里(opendir,readdir,closedir)? 未定义的符号

[英]Where is the code for dirent.h (opendir, readdir, closedir)? Undefined symbol

I'm using Tiny C compiler to compile some C code that uses dirent.h (Just trying to list a directory's contents) When I compile, I get these errors: 我正在使用Tiny C编译器编译一些使用dirent.h的C代码(只是试图列出目录的内容)当我编译时,我得到这些错误:

tcc: error: undefined symbol 'opendir'
tcc: error: undefined symbol 'readdir'
tcc: error: undefined symbol 'closedir'

When I open up dirent.h, here's those 3 function headers: 当我打开dirent.h时,这里有3个函数头:

DIR* __cdecl opendir (const char*);
struct dirent* __cdecl readdir (DIR*);
int __cdecl closedir (DIR*);

This might sound stupid, but where is the actual code for these function headers? 这可能听起来很愚蠢,但这些函数头的实际代码在哪里? It seems to me that's the reason why it doesn't compile. 在我看来,这就是它不能编译的原因。

How can the compiler compile something with just the headers and no the .c code? 编译器如何只用标题编译而不编译.c代码?

Thanks. 谢谢。

Stop using archaic compilers. 停止使用古老的编译器。

Just use GCC (MinGW-w64) or MSVC. 只需使用GCC(MinGW-w64)或MSVC。 You need the POSIX functionality which just happens to be implemented in MinGW-w64 GCC, so you that. 你需要刚刚在MinGW-w64 GCC中实现的POSIX功能,所以你就是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM