cons-discuss
[Top][All Lists]
Advanced

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

Re: cons with c++


From: rick . croote
Subject: Re: cons with c++
Date: Tue, 25 Jan 2005 14:17:28 -0800


Yes, you never specified that Configuration.cpp was part of the project.  Cons does not magically go out and find source code to compile.  Try:

Program $env 'Configuration', 'tConfiguration.cpp', '..\classes\Configuration.cpp';

---
Rick Croote
Software Engineer
Environment and Tools Team
Philips Medical Systems
Bothell, WA
address@hidden
Phone: 425-487-7834








Daniel Graupner <address@hidden>

01/25/2005 01:57 PM

       
        To:        Rick Croote/ATL-BTL/MS/address@hidden
        cc:        address@hidden
        Subject:        Re: cons with c++

        Classification:        




Let me try to describe the situation a bit more precisely ;-)

my directory structure

classes
 Configuration.h
 Configuration.cpp
test
 tConfiguration.cpp #the Programm to test the class
 Construct

Construct contains:
$env = new cons(
        CC      => "g++",
        CPPPATH => "/usr/local/include/:../classes/",
        LIBPATH => "/usr/local/lib/",
        LIBS    => "-lxerces-c",
);
Program $env 'Configuration', 'tConfiguration.cpp';

If I call "cons Configuration" in the test directory than
g++ -I/usr/local/include -I/root/studarb/devel/include/classes -c tConfiguration.cpp -o tConfiguration.o
g++ -o Configuration tConfiguration.o -L/usr/local/lib -lxerces-c
tConfiguration.o(.text+0x136): In function `main':
: undefined reference to `Configuration::Configuration()'
tConfiguration.o(.text+0x170): In function `main':
: undefined reference to `Configuration::parseFile(std::string)'
tConfiguration.o(.text+0x1d5): In function `main':
: undefined reference to `Configuration::~Configuration()'
tConfiguration.o(.text+0x1f0): In function `main':
: undefined reference to `Configuration::~Configuration()'
cons: *** [Configuration] Error 1
cons: errors constructing Configuration


The undefined references are from the class "Configuration" which has currently only 3 functions
(constructor, destructor and parseFile).

Cons never included the class body therefore the errors, I suppose.

This is the command which usually works for me
g++ -I /usr/local/include -L/usr/local/lib/ -lxerces-c -o Configuration ../classes/Configuration.cpp
tConfiguration.cpp


Regads,
Daniel.



address@hidden schrieb:
>
> What you describe, of course, is the common practice, and rest assured
> Cons has no difficulty compiling C++ code.  Our code base that has
> exceeded 7000 CPP files, and at least that in H files, for years.  The
> problem is that you have not provided enough information for us to
> really help further.  Your statement of undefined references leads me to
> believe that you have a linked target that is not specifying the
> expected object files.
>
> ---
> Rick Croote
> Software Engineer
> Environment and Tools Team
> Philips Medical Systems
> Bothell, WA
> address@hidden
> Phone: 425-487-7834
>
>
>
>                  
>
>
>
>
> *Daniel Graupner <address@hidden>*
>
> Sent by:
> address@hidden
>
> 01/25/2005 01:04 PM
>
>                        
>         To:        address@hidden
>         cc:        (bcc: Rick Croote/ATL-BTL/MS/PHILIPS)
>         Subject:        cons with c++
>
>         Classification:        
>
>
>
>
> Hello,
>
> I want to use cons with C++ but have some problems.
>
> I divided my C++Classes in *.h and *.cpp files. The *.h includes the
> class definition, the *.cpp the
> body of the class and includes the corresponding *.h.
>
> In the main program i include the *.h of the class, thats the usual
> practice I thing. Cons is not
> able to resolve the class!! Cons does not compile the body of the
> class...so there are errors with
> undefined references.
>
> Thanks for Help,
> Daniel.
>
>
> _______________________________________________
> address@hidden
> http://lists.gnu.org/mailman/listinfo/cons-discuss
> Cons URL: http://www.dsmit.com/cons/
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]