I can't use windows.h or cstdlib

I'm using the CodeBlocks compiler and whenever I try to use the cstdlib or windows.h header files I get error messages.

I don't know how to explain this so I will just screenshot it.

http://gyazo.com/0fd23836114fe413ccca7ef3eafbb3d4
closed account (zb0S216C)
What does your "main.cpp" look like? I have a sneaking suspicion that the issue relates to the way you're accessing the standard name-space.

Wazzak
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    cout << "Hello World" << endl;
    return 0;
}
closed account (zb0S216C)
According to your error, you were trying to attempt to invoke "std::rand( )". What happened there?

Wazzak
You tell me. This happens everytime I use cstdlib or windows.h in any program. I think there might be something wrong with the compiler.
In the image you linked, rand is missing its return type in the stdlib.h header. I would guess you have inadvertently modified the header.

I have absolutely no idea. Would reinstalling CodeBlocks fix the problem?
If that's the only thing that was botched in the header, you can try replacing line 359 with

_CRTIMP int __cdecl __MINGW_NOTHROW rand (void);
It worked, thank you so much!!!!
Last edited on
Topic archived. No new replies allowed.