Question

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:

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:

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?

Thanks.

OTHER TIPS

Stop using archaic compilers.

Just use GCC (MinGW-w64) or MSVC. You need the POSIX functionality which just happens to be implemented in MinGW-w64 GCC, so you that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top