RE: [Dev-C++] Newbie linking errors: 'undefined reference'
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2002-02-09 22:50:16
|
> -----Original Message-----
> From: Ioannis Vranos [mailto:no...@ya...]
> Sent: Sunday, February 10, 2002 12:10 AM
> To: Dev-C++ (dev...@li...)
> Subject: RE: [Dev-C++] Newbie linking errors: 'undefined reference'
>
>
> Had you included the .cpp file in the project? Also if you
> have the definition of a class in a .cpp file you must
> include a declaration of the class in the scope you use it.
> For example:
>
>
> in the a.cpp file:
>
> class A
> {
> // definition
> };
>
>
> in the file you use it:
>
>
> class A;
>
> A a;
> //..
This is a mistake. You must provide the class definition in every
compilation unit (file) before its use. So better put the class
definition in a header file.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|