Thread: Problem with ostream, error: "undefined symbol 'out' in function main"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2011
    Location
    Russellville, AR
    Posts
    4
    Quote Originally Posted by grumpy View Post
    Error message is self explanatory. You are using something named out, and no such thing exists. If you are trying to print to standard output, the name you need to use is cout.
    Based off some info I found on one of the tutorials, I simply declared it above as:

    fstream out;

    And it compiled perfectly, would that have been appropriate?

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by brunion View Post
    Based off some info I found on one of the tutorials, I simply declared it above as:

    fstream out;

    And it compiled perfectly, would that have been appropriate?
    That depends on what you intend your code to achieve. If you want code that successfully compiles but fails to write anything to a file (that's what happens with a default-constructed fstream) then your solution is perfectly appropriate.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "Undefined Symbol" when compiling a socket program?
    By phummon in forum C++ Programming
    Replies: 4
    Last Post: 07-07-2010, 01:03 PM
  2. "error LNK2001: unresolved external symbol"problem
    By gjgcstick in forum C++ Programming
    Replies: 2
    Last Post: 03-05-2010, 09:06 AM
  3. Replies: 6
    Last Post: 08-26-2008, 12:38 PM
  4. "Unresolved External Symbol" Error
    By mikeman118 in forum C++ Programming
    Replies: 12
    Last Post: 12-20-2007, 10:05 AM
  5. Ask about these "unresolved external symbol" error
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2002, 11:39 AM