G ++ does not link header files correctly

I am using cygwin libraries to run C and C ++ programs on Windows.

gcc

works fine, but since g++

I am getting a long list of errors. I think these erros are related to linking problems with C libraries.

Can you suggest what I need to do to fix this?


initial 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

      

all errors fail: PasteBin


for people requesting the source code: this is obviously a file header issue related to the issue and happens before compilation starts. I am getting 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 same error.

+2


a source to share


1 answer


Key error:

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>

(although it leaves the angle brackets from the post) means that you have some sort of compiler configuration problem. You may be missing an important package. I would look to reinstall or update the GCC environment to <stdio.h>

find it found.

The rest of the problems are consequences of the missing header - the compiler fights without all the information it needs to avoid generating unnecessary errors.

+1


a source







All Articles