Reputation: 1
So I'm kind of a newbie when it comes to g++ and linux, but I'm trying to compile a C++ program that I wrote, and for whatever reason g++ is having issues with my includes, and I get literally thousands of lines of errors from C++ include files (like stdio.h, string.h, etc). I pasted a few of them below:
In file included from /usr/include/stdio.h:75,
from /usr/include/root/Rtypes.h:33,
from /usr/include/root/TObject.h:31,
from /usr/include/root/TNamed.h:26,
from /usr/include/root/TAxis.h:25,
from /usr/include/root/TH1.h:25,
from /usr/include/root/TH1F.h:25,
from torusMC.cpp:10:
/usr/include/libio.h: In function ‘int _IO_feof(_IO_FILE*)’:
/usr/include/libio.h:462: error: expected primary-expression before ‘,’ token
/usr/include/libio.h:462: error: ‘printf’ was not declared in this scope
/usr/include/libio.h:462: error: ‘exit’ was not declared in this scope
/usr/include/libio.h: In function ‘int _IO_ferror(_IO_FILE*)’:
/usr/include/libio.h:463: error: expected primary-expression before ‘,’ token
/usr/include/libio.h:463: error: ‘printf’ was not declared in this scope
/usr/include/libio.h:463: error: ‘exit’ was not declared in this scope
What is really weird, is that I have used the exact same includes before for a different program in a different directory and everything (still) compiles just fine. If I comment them all out, and the code that uses the includes, it compiles fine; if I keep the code using the includes commented out, but comment in even one of the includes I get all the errors again.
Is there something wrong with my environment that makes it fail in this one directory?
Upvotes: 0
Views: 946
Reputation: 213496
The most likely cause: you are #include
ing another header before the TH1F.h
, and in that other header, you have a missing semi-colon, e.g.
// some other header
struct Foo {
....
}
^ missing ;
Upvotes: 1