delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/25/01:05:58

From: demibee <demibee AT post DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Undefined Reference to "cout" in Hello.cpp
Message-ID: <2docvs0a8bp654oqaopnpkaen68blh8s61@4ax.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Lines: 46
Date: Wed, 25 Oct 2000 04:39:41 GMT
NNTP-Posting-Host: 142.177.58.109
X-Complaints-To: abuse AT ns DOT sympatico DOT ca
X-Trace: sapphire.mtt.net 972448781 142.177.58.109 (Wed, 25 Oct 2000 01:39:41 ADT)
NNTP-Posting-Date: Wed, 25 Oct 2000 01:39:41 ADT
Organization: Sympatico-Subscriber
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I've been using DJGPP as a backup C/C++ compiler for a year or so.
Last night I downloaded the most recent ZIPs for use in DOS.  I'm
finding that I have no trouble with C programs.  C++ is a different
story.  Using...

C:\> gcc hello.cpp -o hello.exe

... these...

  ----
    #include <iostream>

    using namespace std;

    int main ()
    {
        cout << "Hello, world." << endl;

        return 0;

    }   // end main


  ----
    #include <iostream>

    int main ()
    {
        std::cout << "Hello, world.\n";

        return 0;

    }   // end main


... yield...

    undefined reference to "cout"
    undefined reference to "endl"


I've tried removing the "std::" and "using namespace" to no avail.
And I've tried adding the ".h" to "iostream"... any ideas?

db

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019