I can't use windows.h or cstdlib

Dec 27, 2012 at 1:40am
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
Dec 27, 2012 at 1:46am
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
Dec 27, 2012 at 1:50am
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;
}
Dec 27, 2012 at 1:53am
closed account (zb0S216C)
According to your error, you were trying to attempt to invoke "std::rand( )". What happened there?

Wazzak
Dec 27, 2012 at 1:55am
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.
Dec 27, 2012 at 1:55am
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.

Dec 27, 2012 at 1:57am
I have absolutely no idea. Would reinstalling CodeBlocks fix the problem?
Dec 27, 2012 at 2:04am
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);
Dec 27, 2012 at 2:09am
It worked, thank you so much!!!!
Last edited on Dec 27, 2012 at 2:09am
Topic archived. No new replies allowed.