Article View: gnu.gcc.help
Article #913how can i tell if my new c++ compiler is working?
From: UNLISTED
Date: Mon, 04 Sep 1995 19:43
Date: Mon, 04 Sep 1995 19:43
43 lines
1411 bytes
1411 bytes
i just finished installing the libg++ library for c++ and i want to test the
compiler to see if it is working. when i try to compile the following little
test file using gcc,
i get these errors:
collect2: ld returned 2 exit status
ld: Undefined symbol
String::length(void)
String::set_to(char *)
String::read(void)
what do these errors mean i did or didn't do?
(i'm new at c++)
below are the files...
/* this is the beginning of file String.h */
const int max_string_length = 128;
class String{
public:
void set_to(char*);
int length();
int read();
void print();
private:
char text[max_string_length+1];
};
/* this is the end of file String.h */
/* and the beginning of file test.cc */
#include "String.h"
#include<stdio.h>
main(int, char *[])
{
String s, t;
s.set_to("hello world");
printf("Length of s is %d\n", s.length());
printf("Enter string t: ");
t.read();
printf("Length of t is %d\n",t.length());
return 0;
}
/* this is the end of file test.cc */
Technical Details
Message-ID:
<42fktm$g2p@news.acns.nwu.edu>Path:
arc1-ca.pugleaf.net!casbah.acns.nwu.edu!bcc063Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!casbah.acns.nwu.edu!bcc063 From: bcc063@casbah.acns.nwu.edu (UNLISTED) Newsgroups: gnu.gcc.help,comp.lang.c++,comp.unix.programmer Subject: how can i tell if my new c++ compiler is working? Date: 4 Sep 1995 19:43:50 GMT Organization: Northwestern University, Evanston IL Message-ID: <42fktm$g2p@news.acns.nwu.edu> NNTP-Posting-Host: unseen1.acns.nwu.edu