OT: c++ q

OT: c++ q

Shachar Shemesh shachar at shemesh.biz
Sun Apr 26 15:43:36 IDT 2009


Erez D wrote:
> hi
>
> i have encountered a problem with g++
>
> i have a class a, with forward declaration of a function 
> "do_something" and a constructor a(int val);
> i implement them in a cpp file.
>
> g++ complains of redefinition of the constructor but not of the 
> do_something() function.
>
> why ?
>
> files:
> == a.h ===
> class a {
> int m_a;
>  a (int val);
>  void do_somthing()
> }
>
> == a.cpp ===
> #include "a.h"
> a::do_somthing {a.m_a++;};
> a::a(int val):m_a(val) {};
>
> ============
>
>
> any idea ?
>
Send an actual couple of files. What you sent is impossible to debug (I 
doubt g++ does not complain that do_somthing is defined with no return 
type and no parenthesis).

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20090426/0680f871/attachment.html>


More information about the Linux-il mailing list