Broken library?

I'm pretty darn sure I've done something to mess up my <cstdio>.

Whenever i'm including that lib it makes this insane error that it nested to deep while it opens the cstdio.

I'm using Codeblocks and i've tried reinstalling severel times with no luck.

Any pointers as what to do?

Without seeing your code its guess work - This error occurs if the preprocessor encounters too many nested #include directives . It is usually caused by two or more files trying to include each other, leading to an infinite recursion.

Also, have you got multiple headers in your project, and in those headers do you have header guards such as

1
2
3
4
5
6
7
8
#ifndef _H_MYHEADER_
#define _H_MYHEADER_

// do your stuff



#endif 
Last edited on
This may also occur if you have an invalid or incomplete statement somewhere in your own header. like
1
2
3
4
5
6
7
8
9
10
11
12
struct a
{
};

struct b
{

// Note: missing };

struct c
{
};
That's just the problem. It occurs in every projekt, regardless what's in it.


1
2
3
4
5
6
7
8
#include <cstdio>

using namespace std;
int main()
{
    cout << "Hello, World";
    return 0;
}
You don't use anything from <cstdio> in your example. (std::cout is in <iostream>)

PS. Avoid using namespace std;
http://www.gotw.ca/gotw/053.htm
Thx for the link, I'll look into that later today=)

I know, but even if I use something from the link, in example getchar(), it does'nt change anything. It simply won't compile.
I'm not quite sure how to explain the problem, since the errors it makes en the build log is endless, it totally screws up:(


Endless is unlikely, but very long can it be. What is the first error?
It has 3 lines of "#Include nested to deeply"

Then it starts with
::fpos_t has not been declared
::clearerr has not been declared

and it goes on
Can I reinstall only the library?
could you post your code?

The best thing here as Little Bobby Tables wrote is to post the whole of your code since its pretty much guess work to everyone involved.

The thing is, there is no code. It's no matter what, as long as i include <cstdio>, then it won't compile. It stops when it meets cstdio

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    printf("Hello world!") << endl;
    return 0;
}
Last edited on
well see thats because printf("Hello, world!") << endl doesnt work. that has nothing to do with the stl
That's because i'm such a newb i don't even know how to code it right.

Nevertheless, the compiler never gets to the error, it stops when it gets to the #include cstdio, so it won't even tell me about my mistake =)

I'm pretty sure it's not about the code, because the compiler never get to the code, it only get to the include cstdio?
C++ compiler writers have to juggle an insane lanugage syntax with multple file inclusions and object prototypes, etc... It doesn't always catch errors where you think it ought.

Try to compile a correct program and see if the error doesn't go away.
Topic archived. No new replies allowed.