C++ question 5 replies

Please wait...

The_Computer_Wizard

The Force is strong with him

50 XP

10th September 2006

0 Uploads

321 Posts

0 Threads

#1 12 years ago

hey, ok one just to get this out of the way, i am kotfquig so any similarties in graphic work you see im not stealing from him, i am him ok now to my question i was using an older version of dev-C++ 4, and my friend was tryin to show me something and hes like "dude get a newer version and this will work better" (i think it had something to do with it came with more header files or w/e) so now like 75% of the time even on the simpelest of programs its saying cout and cin are undeclared functions, and it wont work at all idk why, ive been trying to figure it out for about a day now, but its not like a programming error cause i tried the simple "hello world" program (many of you will probably know what im talking about) and that still said it anyone know dev and know of something i have to do?




Revenge VIP Member

Shizzle my nizzle

117,165 XP

28th July 2004

0 Uploads

10,354 Posts

0 Threads

#2 12 years ago

Are you including the header file iostream? This is where the cin and cout functions are defined, so it needs to be there.

#include

using namespace std;

int main() { cout << "Hello!"; return 0; }




The_Computer_Wizard

The Force is strong with him

50 XP

10th September 2006

0 Uploads

321 Posts

0 Threads

#3 12 years ago

this is the exact program im trying to run #include unsigned int strlen(const char s[]) {unsigned int i, len=0; for (i=0; s[i]!='\0'; i++) len++; //copied from iteration example above return len; }; int main() { char line[80]; for ( ;; ) { cout << "type" " a " "word>"; cin >> line; cout << strlen(line)<<"\n"; } return 0; }

i got this from a site because this new version of dev wont let me use the string header i used to use (idk its just not there) so i was looking for a new way to do a string, and this is the exact error message `cout' undeclared (first use this function) (Each undeclared identifier is reported only once for each function it appears in.) `cin' undeclared (first use this function)




Revenge VIP Member

Shizzle my nizzle

117,165 XP

28th July 2004

0 Uploads

10,354 Posts

0 Threads

#4 12 years ago

That's probably a missing header file then. Maybe it got deleted by accident by Dev-C++. Try downloading the latest version here.




The_Computer_Wizard

The Force is strong with him

50 XP

10th September 2006

0 Uploads

321 Posts

0 Threads

#5 12 years ago

well it seems to have worked, so i think that was it apparently i downloaded version 5 beta, so i think thats just something they need to fix, but the finished version of 4 seems to be working great




LaughingCheese

Behold the Power of CHEESE!!!

50 XP

16th June 2004

0 Uploads

1,100 Posts

0 Threads

#6 12 years ago

sort of off topic, not trying to hijack a thread or anything, but how is development coming on Dev-C++?

Seems to be dead...