Advertising (This ad goes away for registered users. You can Login or Register)

Missing Headers

Discuss about your favorite (gaming...or not) devices here. The most popular ones will end up getting their own categories
Programming discussions for your favorite Device
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
HeroKing
Posts: 712
Joined: Mon Nov 29, 2010 5:51 pm

Missing Headers

Post by HeroKing »

i just tried once again with a package electrosheep posted in off-topic, and i think i found my issue. his script calls up the srand and rand functions, without them being declared. i looked them up, and found they're in the cstlib header file. i added it to the header list, and it says it's not included. i checked, and the only solution i've found is to install build-essential or libc6-dev, which i already have. it looks like that file is no longer included, and now i can't seem to find it anywhere
Advertising
Image
Strangelove
Posts: 286
Joined: Thu Nov 25, 2010 6:32 pm

Re: Missing Headers

Post by Strangelove »

to use rand() you need to include stdlib.h

cstdlib is only used if you program in C++ and then all your standard C library functions will be namespaced.
Advertising
"If you have specific questions ... don't hesitate to ask as the more generic the question is the more philosophic the answer will be" - PSPWizard
HeroKing
Posts: 712
Joined: Mon Nov 29, 2010 5:51 pm

Re: Missing Headers

Post by HeroKing »

this is programmed in C++. all the headers that are used come from C++ libraries
Image
Strangelove
Posts: 286
Joined: Thu Nov 25, 2010 6:32 pm

Re: Missing Headers

Post by Strangelove »

ok. if it's just a matter of a missing file, try:
sudo apt-get install gcc g++
this should install all the needed files including libstdc++-dev which holds the header files.
"If you have specific questions ... don't hesitate to ask as the more generic the question is the more philosophic the answer will be" - PSPWizard
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Missing Headers

Post by m0skit0 »

He should already have that if he installed build-essentials package.
HeroKing wrote:all the headers that are used come from C++ libraries
Sorry but no. rand() is a C function as comes in C headers, not C++ ones. In fact with cstdlib you're actually indirectly calling C's stdlib.h.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
HeroKing
Posts: 712
Joined: Mon Nov 29, 2010 5:51 pm

Re: Missing Headers

Post by HeroKing »

either way, i'm also mission stlib.h. i did a search on my system, and only thing i found was a histlib.h under psptoolchain. not sure if it's the same thing or not
Image
Salmon
Posts: 68
Joined: Fri Jan 07, 2011 12:08 pm

Re: Missing Headers

Post by Salmon »

Could you post the code you're trying to compile?
HeroKing
Posts: 712
Joined: Mon Nov 29, 2010 5:51 pm

Re: Missing Headers

Post by HeroKing »

same program i got from here - http://www.wololo.net/talk/viewtopic.ph ... 03&start=0

Edit: found stlib.h online and saved it. now just trying to find where to put it
Image
Salmon
Posts: 68
Joined: Fri Jan 07, 2011 12:08 pm

Re: Missing Headers

Post by Salmon »

You need to include the cstdlib header.
Add the following line:

Code: Select all

#include <cstdlib>
The above allows me to compile the code using gcc/g++ 4.6.0
Strangelove
Posts: 286
Joined: Thu Nov 25, 2010 6:32 pm

Re: Missing Headers

Post by Strangelove »

if you're compiling C++ stuff make sure to use g++ and not gcc.

edit:
i don't have the cstlib file, and can't find it online. i got stlib.h downloaded now, but trying to find my other C headers to put it with them
*facepalm* in all likelyhood you have all the files installed already. and it's called stdlib not stlib! by manually downloading stuff and installing it you risk permanently breaking your compiler. adding more problems than you originally had.
Last edited by Strangelove on Fri Jul 29, 2011 9:37 am, edited 1 time in total.
"If you have specific questions ... don't hesitate to ask as the more generic the question is the more philosophic the answer will be" - PSPWizard
Locked

Return to “Programming and Security”