Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Unhappy Unanswered: 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?

  2. #2
    Join Date
    May 2005
    Posts
    13
    I was wondering the same thing - it's in the official FAQ.

    From that page...

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

    #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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •