Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ string handler problem
#41
This brings up a nice host of error messages when you try to comile it in my version of TC++ (v1.0, or 1.1, not sure):
Code:
#include <iostream>
using namespace std;
#include <strng.h>
int main()
{
string whatever="whatever";
cout << whatever;
return 0;
}
Unknown identifier on the using namespace and #include <iostream> lines, undefined symbol "string" and "cout".
But don't worry - I use Mingw32 now.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#42
Doh! I wasnt talking about TC++. Its old, ancient, deprecated itself! Try it in MingW32, DJGPP, Cygwin or any of the newer compilers =)
Reply
#43
Oh, I know the new standard, alright. I just wanted to point out to you TC++ 1.0/1.1 doesn't support the modern standard.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#44
Ah, I should have had been more clear while mentioning it =(
Reply
#45
That is what i mean to say (sorry about my english), getche is in conio (c library) and cout is in iostream (c++ library).

Quote:Actually, xhantt, I fixed the problem by placing a cout << endl; between the two function calls in main(). The problem was that getche() didn't increment the x-character-position, so the cout call in outStr was printing right over what user types.

Don't forget the openwatcom. (does anybody try this?)
Quote:Doh! I wasnt talking about TC++. Its old, ancient, deprecated itself! Try it in MingW32, DJGPP, Cygwin or any of the newer compilers =)
Reply
#46
Yeah, you are correct. It isnt advisable to use c and c++ libraries at the same time =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)