Please excuse me,
I'm a proficient C programmer in a GNU/Linux environment who is attempting to learn to program on Windows. I decided I would use MinGW and MSYS to mimic the environment I was already used to (I'm not inclined to get to used to VC++ if you get my drift).
So, after reading the lovely documentation, I seem to have everything installed correctly and even got my hello world program running. Huzzah.
Well, suddenly an error came up when trying to port one of my old programs. I have a function which does this:
Yes, I'm sure there is a better way to check to see if something is a directory, but let's focus on the errorCode:int isDir(char *candidate) { DIR * dir = opendir(candidate); if (dir == NULL) { return 0; } else { return 1; } }
I compile like so: gcc donner4.c -o donner4 -lpthreads (pthreads is working)
I get this:
In file included from donner4.c:16:
C:/msys/1.0/mingw/include/sys/dirent.h:62: parse error before "__ino64_t"
C:/msys/1.0/mingw/include/sys/dirent.h:66: parse error before '}' token
C:/msys/1.0/mingw/include/sys/dirent.h:69: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:70: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:71: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:72: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:73: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:75: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:79: parse error before '*' token
C:/msys/1.0/mingw/include/sys/dirent.h:80: parse error before '*' token
donner4.c: In function `isDir':
donner4.c:54: `dir' undeclared (first use in this function)
donner4.c:54: (Each undeclared identifier is reported only once
donner4.c:54: for each function it appears in.)
So we at least know dirent.h is being included.
Again, I'm not experienced enough with MinGW or Windows programming in general to know what the matter is, only that Google has a bunch of dirent.h problems online (of course, my ignorance renders me incapable of comprehending them).
Would a kind soul be willing to help me? I would most appreciate it.
Thanks!
rokenrol
EDIT (a few minutes later):
You should also know that this is a completely new install of what I believe is the latest version of everything involved, so if versions matter that might help you.
Also, the program works perfectly fine back on Slackware. But in Windowsland it fails. Anyone surprised?
Again, grazie!