newbie question on linking classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux