Chapter 13 TestPropertySet

An Object-oriented Approach

Chapter 13 TestPropertySet

Postby Tartaglia » Sat Feb 15, 2014 7:22 pm

Hello everyone,



I am trying to run 'TestPropertySet.cpp' from Chapter 13, however I am experiencing some difficulties. I am using the Borland Compiler 5.5.1 and using the following command from the cmd-Box:



bcc32 -eMain testPropertySet.cpp property.cpp propertything.cpp simplepropertyset.cpp



That is, I compile all the cpp-Files of the template Classes that are used. I am getting a long list of compiler errors, to name one for the most fundamental class:



Error2171 PropertyThing.cpp 20: Body has already been defined for funcion PropertyThing<Name,Value>::PropertyThing<>



Does anyone have an idea what I am doing wrong?



I appreciate your help.



Best regards,

Metin
Tartaglia
 
Posts: 4
Joined: Sat Jan 18, 2014 8:28 pm

One Error less

Postby Tartaglia » Sun Feb 16, 2014 4:27 pm

So I seem to have identified one mistake in 'propertything.hpp'. As the compiler error already pointed out, the body of the functions was already defined in the header file (curly brackets after all the declarations of the constructors). So after erasing those bodies from the header I do not get any mistakes anymore with 'propertything.cpp'. Which leaves me with the compiler errors with 'property.hpp':



Error E2041 property.hpp 22: Incorrect use of default

Error E2428 property.hpp 22: Templates must be classes or functions



Does anyone have suggestions? Please note that I am using the exact files from the CD, nothing changed.



Thanks,

Metin
Tartaglia
 
Posts: 4
Joined: Sat Jan 18, 2014 8:28 pm

Line 22

Postby Tartaglia » Sun Feb 16, 2014 5:27 pm

This is line 22 from the property.hpp:



template <class Name = string, class Value = double> class Property : public PropertyThing<Name, Value>



I cannot spot any errors here.
Tartaglia
 
Posts: 4
Joined: Sat Jan 18, 2014 8:28 pm

Postby Tartaglia » Mon Feb 17, 2014 10:56 pm

For completeness sake, below you can see the entire output:



D:\...\Property>bcc32 -eMain testpropertyset.cpp property.cpp propertything.cpp

Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland

TestPropertySet.cpp:

Error E2041 property.hpp 22: Incorrect use of default

Error E2428 property.hpp 22: Templates must be classes or functions

Error E2141 property.hpp 22: Declaration syntax error

Error E2428 property.cpp 28: Templates must be classes or functions

Error E2141 property.cpp 28: Declaration syntax error

Error E2139 c:\Borland\Bcc55\include\typeinfo.h 89: Declaration missing ;

Warning W8038 c:\Borland\Bcc55\include\typeinfo.h 111: Constant member 'type_in

o::_BORGUID' is not initialized in function type_info::type_info(tpid *)

*** 6 errors in Compile ***

Property.cpp:

Error E2041 property.hpp 22: Incorrect use of default

Error E2428 property.hpp 22: Templates must be classes or functions

Error E2141 property.hpp 22: Declaration syntax error

Error E2428 Property.cpp 28: Templates must be classes or functions

Error E2141 Property.cpp 28: Declaration syntax error

*** 5 errors in Compile ***

PropertyThing.cpp:
Tartaglia
 
Posts: 4
Joined: Sat Jan 18, 2014 8:28 pm


Return to Introduction to C++ for Financial Engineers (Duffy)

Who is online

Users browsing this forum: No registered users and 0 guests