OT: c++ q
Erez D
erez0001 at gmail.com
Sun Apr 26 15:53:13 IDT 2009
On Sun, Apr 26, 2009 at 3:43 PM, Shachar Shemesh <shachar at shemesh.biz>wrote:
> 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
>
you are right. i just wanted to give a small example instead of send my
whole project to be inspected.
however after fixing the syntax of this small example, i can't seem to
duplicate the problem that happened in the project.
so thanks anyway.
erez.
>
> --
> 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/b6b72b73/attachment.html>
More information about the Linux-il
mailing list