I can't use windows.h or cstdlib

plusone (20)
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
Framework (3242)
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
plusone (20)
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;
}
Framework (3242)
According to your error, you were trying to attempt to invoke "std::rand( )". What happened there?

Wazzak
plusone (20)
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.
cire (2362)
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.

plusone (20)
I have absolutely no idea. Would reinstalling CodeBlocks fix the problem?
cire (2362)
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);
plusone (20)
It worked, thank you so much!!!!
Last edited on
Topic archived. No new replies allowed.