Re: cons with c++
Daniel Graupner <[email protected]> Tue, 25 Jan 2005 22:57:45 +0100
| Newsgroups | gmane.comp.gnu.cons.general |
|---|---|
| Message-ID | <[email protected]> |
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.
[email protected] 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
> [email protected]
> Phone: 425-487-7834
>
>
>
>
>
>
>
>
> *Daniel Graupner <[email protected]>*
>
> Sent by:
> [email protected]
>
> 01/25/2005 01:04 PM
>
>
> To: [email protected]
> 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.
>
>
> _______________________________________________
> [email protected]
> http://lists.gnu.org/mailman/listinfo/cons-discuss
> Cons URL: http://www.dsmit.com/cons/
>
_______________________________________________
[email protected]
http://lists.gnu.org/mailman/listinfo/cons-discuss
Cons URL: http://www.dsmit.com/cons/