www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/16/06:45:24

From: "Chia" <chia AT top DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: c:/djgpp/tmp\ccwaaaaa... undefined reference to...
Date: Wed, 15 Jul 1998 18:56:42 -0500
Organization: 404 Software
Lines: 53
Message-ID: <6ojfpr$jsk@nnrp3.farm.idt.net>
NNTP-Posting-Host: usr1-34.top.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi all.

I have been using DJGPP for quite awhile now.  I have never successfully
been able to compile a cout<< or use any functions from the C++ headers.

I have finally reached a point where I need to be able to use the String
class.

My test.cpp program is this:

    #include <stdio.h>
    #include <_string.h>

    int main(void) {
      String MyString = "Text";
      printf(MyString);
      return 0;
    }

When I try to compile, this program gives me "undefined references" to:

    String::String(char const *)
    String::operator char const *(void) const
    String::~String(void)

I compile with the following command:

           gcc test.cpp -o test.exe

I have similar problems when I try to do cout<< and iostream.h functions.

I do have the C++ libraries installed and have downloaded lgp271b.zip.
I have my FILES=15 in config.sys per the DJGPP faq.
I have confirmed that my set DJGPP=c:/djgpp/djgpp.env and that the DJGPP
directory is in my PATH.
I have Win95 and a loaded p2-266.

The compiler is apparently finding the header okay becuase it doesn't give
me a parse error in my declaration of MyString, it just tells me it can't
find the method.

These errors strike me as very similar to what happens when using allegro if
you forget the "-lalleg" while compiling, so is there some switch I need to
use when compiling these?

Any help is greatly appreciated... I'm sorry if this is in the documentation
somewhere but i've looked all over for it and not found an answer.

Thanks!

// chia AT top DOT net -- http://www.top.net/chia/


- Raw text -


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