If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > open Watcom c++ problem to compile easy code, please help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-06, 14:41
JuliaNadine JuliaNadine is offline
Registered User
 
Join Date: Oct 2006
Posts: 1
Unhappy open Watcom c++ problem to compile easy code, please help

Hi,
i want test Watcom c++, but i have the problem to compile easy code.
In visual c++ is that code no problem:

#include <iostream>
#include <string>
using namespace std;

int main ()
{
string mystring = "Hello";
cout << mystring << endl;
cin >> mystring;
cout << mystring;

return 0;
}


And the compiler error:

cd C:\WATCOM\programmieren
wmake -f C:\WATCOM\programmieren\noname.mk -h -e -a C:\WATCOM\programmieren\u.obj
wpp386 u.cpp -i=C:\WATCOM\h;C:\WATCOM\h\nt -w4 -e25 -zq -od -d2 -6r -bt=nt -mf -xs -xr
u.cpp(8): Error! E157: col(10) left expression must be integral
u.cpp(8): Note! N717: col(10) left operand type is 'std:stream watcall (lvalue)'
u.cpp(8): Note! N718: col(10) right operand type is 'std::basic_string<char,std::char_traits<char>,std ::allocator<char>> (lvalue)'
u.cpp(9): Error! E157: col(9) left expression must be integral
u.cpp(9): Note! N717: col(9) left operand type is 'std::istream watcall (lvalue)'
u.cpp(9): Note! N718: col(9) right operand type is 'std::basic_string<char,std::char_traits<char>,std ::allocator<char>> (lvalue)'
u.cpp(10): Error! E157: col(10) left expression must be integral
u.cpp(10): Note! N717: col(10) left operand type is 'std:stream watcall (lvalue)'
u.cpp(10): Note! N718: col(10) right operand type is 'std::basic_string<char,std::char_traits<char>,std ::allocator<char>> (lvalue)'
Error(E42): Last command making (C:\WATCOM\programmieren\u.obj) returned a bad status
Error(E02): Make execution terminated
Execution complete

PLEASE can anybody help me?
Reply With Quote
  #2 (permalink)  
Old 11-21-06, 17:35
pico pico is offline
Registered User
 
Join Date: May 2005
Posts: 13
I was wondering the same thing - it's in the official FAQ.

From that page...

Quote:
Why doesn't the simple string program below work?
The program

Quote:
#include <iostream>
#include <string>

int main()
{
std::string word;

std::cin >> word;
std::cout << word;
return 0;
}
won't compile with the OWSTL included with Open Watcom v1.4 or v1.5. This is because OWSTL does not yet support I/O operators for std::string. The intention is to add such operators when the iostreams library is modernized. In the meantime you have to do I/O on strings using older methods and then convert the old-style strings to and from std::string.
Most annoying.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On