struct dirent does not have de_type in header file
<p>So I have a project where I need to build a small simple text shell that can run, edit, and read files from a directory. I have a small prototype that should work, except when I compile, I receive an error about d_type not found within the struct dirent used in the dirent.h header file.</p>

<pre><code>d = opendir( "." );
c = 0;
while ((de = readdir(d))){
    if ((de-&gt;de_type) &amp; DT_DIR)
    printf( " ( %d Directory: %s ) \n", c++, de-&gt;de_name);
}
</code></pre>

<p>the variable "de" is of type struct dirent* and is being checked for it's type, and I get the error: 'struct dirent' has no member named 'de_type'</p>

<p>Here's where I'm really stumped and confused: I've compiled this code on both windows(using dev C++), and on Ubuntu(using gcc). I have recieved the same error on both OS's, and when I checked the library used, which is the normal gnu C library I believe, there is a variable there named d_type:</p>

<p><a href="https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html" rel="nofollow">https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html</a></p>

<p>I have found other references to a dirent.h file that doesn't because one is in a different library, and if that is the case, how do I load that library so I can compile the code? </p>

<p>Sorry for the long post and many thanks to all who answer!</p>