public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrea Bocci <fwyzard@inwind.it>
To: Baraclese <webmaster@baraclese.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: c++ compilation error (undefined reference)
Date: Mon, 28 Oct 2002 03:12:00 -0000	[thread overview]
Message-ID: <5.1.1.6.2.20021028121034.00ba3450@popmail.libero.it> (raw)
In-Reply-To: <3DBC894B.1000905@baraclese.com>

The compiler is telling you that it cannot find the TGA constructor. Well, 
can't blame it, you didn't provide one :-)
IIRC, to get the default constructor (doing nothing but allocating the 
class itself, more or less) and esructor (idem), you sould not declare them.
If you do, the compiler expect you do define them, too, hence the link error.

fwyzard

At 01.48 28/10/2002 +0100, Baraclese wrote:
>Hi, I wrote a TGA header file and I wanted to test it with a small main file.
>tga.h looks something like this:
>class TGA
>{
>         public:
>
>                 TGA();
>                 TGA(char *filename);
>                 ~TGA();
>
>                 bool load(char const *filename);
>}
>
>tga.cpp looks like this:
>
>#include "tga.h"
>using namespace std;
>
>main()
>{
>         TGA image;
>
>         cout << "Filename: ";
>         cin >> image.filename;
>
>         if (image.load(image.filename))
>                 cout << "File successfully read./n";
>         return 0;
>}
>
>When compiling using gcc 3.2 I receive the following error message:
>
>$ g++ -mno-cygwin -lstdc++ f:/projects/cpp/tga.cpp -o tga.exe
>/cygdrive/c/WIN98/TEMP/cccSDKcK.o(.text+0x9f0):tga.cpp: undefined 
>reference to `TGA::TGA()'
>
>What's the problem here?
>
>regards,
>Baraclese


      reply	other threads:[~2002-10-28 11:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-27 16:48 Baraclese
2002-10-28  3:12 ` Andrea Bocci [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.1.1.6.2.20021028121034.00ba3450@popmail.libero.it \
    --to=fwyzard@inwind.it \
    --cc=gcc-help@gcc.gnu.org \
    --cc=webmaster@baraclese.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).