public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Koyel Mukherjee" <koyelmjee@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: newbie question on linking classes
Date: Thu, 27 Mar 2008 16:11:00 -0000	[thread overview]
Message-ID: <a7162eaa0803270910qf021910wf668af246e5ba619@mail.gmail.com> (raw)

Hi

I am a newbie on using gcc and linking files. I have defined some
classes (.h and .cpp files) which I want to use in my main function
defined in a source file(containing the main() function. I have kept
all the class files (.h and .cpp) along with the .cpp source file in
one directory. When I compile only using :
  g++ source.cpp
 it compiles fine. However, when I try to link it too, by writing:
g++ source.cpp -o source_e
I get a series of errors containing
 : undefined reference to func (say) where func is say, a function I
have declared in one of my class files. It seems that it is not able
to link properly . I have included the header files of the classes in
the source file. However I am still getting this error. I tried
specifying the directory where all these files are by the -B option
but it did not help either. Please help me out!

Thanks a lot.

Regards
Koyel

             reply	other threads:[~2008-03-27 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 16:11 Koyel Mukherjee [this message]
2008-03-27 16:40 ` John Love-Jensen
2008-03-27 19:25   ` Koyel Mukherjee

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=a7162eaa0803270910qf021910wf668af246e5ba619@mail.gmail.com \
    --to=koyelmjee@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).