Reputation: 10861
I am using cygwin libraries to run C and C++ programs on Windows.
gcc
runs fine, but with g++
, I get a long list of errors. I think these erros are because of linking problems with C libraries.
Can you suggest what I need to do to fix this?
beginning error lines:
In file included from testgpp.cpp:1:
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:52:19: stdio.h: No such file or directory
In file included from testgpp.cpp:1:
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:99: error: `::FILE' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:100: error: `::fpos_t' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:102: error: `::clearerr' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:103: error: `::fclose' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:104: error: `::feof' has not been declared
the whole error dump: PasteBin
for people asking for source code: this this is clearly a header file linking issue and happens before the compilation even starts. I get the same error for every .cpp file.
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
cout<<"hello world!";
}
gives me the very same error.
Upvotes: 2
Views: 6164
Reputation: 753625
The key error is:
In file included from testgpp.cpp:1:
[...]/include/c++/cstdio:52:19: stdio.h: No such file or directory
The fact that G++ is complaining that it cannot find <stdio.h>
(though it leaves the angle brackets out of the message) means you have a compiler configuration problem of some sort. Probably, you are missing a crucial package. I would look to reinstall or update your GCC environment, so that <stdio.h>
ends up being found.
The rest of the problems are consequences of the missing header - the compiler is struggling on without all the information it needs to avoid generating unwarranted errors.
Upvotes: 1