Newbie problem with the String class
Jerry L Kreps
JerryKreps at alltel.net
Wed Feb 9 12:44:52 GMT 2000
Or,
#include <iostream.h>
#include <string.h>
char s[30]; // string to hold phrase
main()
{
strcpy(s,"Hello World.");
cout << s << '\n';
return (0);
}
Eric Rouse wrote:
>
> Try this instead then work on String - note standard library headers
> don't have the .h and also make sure your using the new gcc compiler
> (2.95.2 - www.gcc.org) if you want to use exceptions...
>
> #include <iostream>
> using namespace std;
>
> int main ()
> {
> cout << "Hello, World." << endl;
>
> return 0;
> }
>
> Regards,
> Eric
>
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
>
> On 2/8/00, 5:12:34 PM, Martin Wiebusch <marwie at gmx.net> wrote regarding
> Newbie problem with the String class:
>
> > Hi, I'm new to KDevelop. I was trying to write a simple C++ program
> > (that "Hello world" stuff). It looks like that:
>
> > #include <iostream.h>
> > #include <stdlib.h>
> > #include <String.h>
>
> > int main(int argc, char** argv)
> > {
> > String s = "Hello world";
>
> > cout << s << endl;
> > return EXIT_SUCCESS;
> > }
>
> > Now, when I select "Compile file" everything works fine, but when I
> > select "Make" or "Rebuild all" I get following error messages:
>
> > undefined reference to 'String::String(char const *)'
> > undefined reference to 'String::~String(void)'
> > undefined reference to 'String::~String(void)'
>
> > (Yes, I get the last one twice) There ist a file "String.h" in the
> > directory /usr/include/g++/ and in that file the String class and the
> > above mentioned constructor and destructor are defined.
>
> > Has anyone an idea of what's going wrong there?
More information about the KDevelop
mailing list