0

I have the following class and added the class's folder in my C/C++ -> General -> Additional Include Directories

.h file

#include "PropertyCollectionPersistent.h"

namespace Pulsepay { namespace int_layers { namespace common
{
    using Pulsepay::server::common::CPropertyCollectionPersistent;
    using Pulsepay::server::common::CPropertySinkDefImpl;

    class CCommonSettings :
        public CPropertyCollectionPersistent,
        public CPropertySinkDefImpl
    {
    public:
        CCommonSettings(void);
        ~CCommonSettings(void);
    };
}}}

.cpp file

#include "StdAfx.h"
#include "Pulsepay_Int_Layers_Common_Settings.h"
#include "PropertyCollection.h"

using namespace Pulsepay;
using namespace Pulsepay::int_layers;
using namespace Pulsepay::int_layers::common;
using namespace Pulsepay::server;
using namespace Pulsepay::server::common;

namespace Pulsepay { namespace int_layers { namespace common { namespace details
{
    using Pulsepay::server::common::CProperty;

    static LPCTSTR  SettingAttribute__SettingStartUpSave     = _T("StartupSave");
    static LPCTSTR  SettingAttribute__DataProviderConnectStr = _T("DataProviderConnectStr");
    static LPCTSTR  SettingAttribute__LanguagePack_Key__Name = _T("LanguagePack__Key__Name");
    static LPCTSTR  SettingAttribute__LanguagePack_Key__Path = _T("LanguagePack__Key__Path");
    static LPCTSTR  SettingAttribute__DataProviderConnectDef = _T(".\\storage\\term2__local__main.mdb");
    static LPCTSTR  SettingAttribute__UseExternalDataSource  = _T("UseExternalDataSource");

    Pulsepay::server::common::Raw__PropertyItem  SettingAttribute__Enum[] = {
        {0xa1, SettingAttribute__SettingStartUpSave    , CProperty::EPT__Integer, _T("0") },
        {0xa2, SettingAttribute__LanguagePack_Key__Path, CProperty::EPT__Text   , _T(".\\PVSCLIENTAPP_USEGUIDE.LANG") },
        {0xa3, SettingAttribute__DataProviderConnectStr, CProperty::EPT__Text   , _T("") },
        {0xa4, _T("DataProviderDefaultURL")            , CProperty::EPT__Text   , SettingAttribute__DataProviderConnectDef},
        {0xa5, _T("NativeControlDataFile")             , CProperty::EPT__Text   , _T(".\\storage\\PVSUSERDATACTRL.TBL")},
        {0xa6, _T("NativeVeinImageDataFile")           , CProperty::EPT__Text   , _T(".\\storage\\PVSVEINDATA.DAT")},
        {0xa7, SettingAttribute__UseExternalDataSource , CProperty::EPT__Integer, _T("1")}
    };
}}}}

////////////////////////////////////////////////////////////////////////////

CCommonSettings::CCommonSettings(void) : CPropertyCollectionPersistent(_T("CommonSettings"), *this)
{
    CPropertyCollectionPersistent::Create(details::SettingAttribute__Enum, _countof(details::SettingAttribute__Enum), false);
}

CCommonSettings::~CCommonSettings(void)
{
}

Now I whant to use above class from my project main function

When I don't use new operator I didn't get any errors

int_layers::common::CCommonSettings ccSetings();

Problem is appears when I use the new operator

int_layers::common::CCommonSettings *ccSetings;
ccSetings = new int_layers::common::CCommonSettings;

I get the following error

error LNK2019: unresolved external symbol "public: __thiscall Pulsepay::int_layers::common::CCommonSettings::CCommonSettings(void)" (??0CCommonSettings@common@int_layers@Pulsepay@@QAE@XZ) referenced in function _main

Please help!

user3451925
  • 33
  • 2
  • 6
  • 1
    When you don't use the new operator, all you are doing id declaring a function called ccSetings which returns int_layers::common::CCommonSettings. You are not declaring a variable. The link error is caused by the declaration of CCommonSettings being outside the namespace. – cup Jun 08 '14 at 07:30
  • So what's the solution ? – user3451925 Jun 08 '14 at 07:34

1 Answers1

0

This is not an answer, but I want to be able to quote code properly:

namespace Pulsepay { namespace int_layers { namespace common { namespace details
{
using Pulsepay::server::common::CProperty;

static LPCTSTR  SettingAttribute__SettingStartUpSave     = _T("StartupSave");
// ...
}}}}    // All namespaces closed here.

So what's the namespace of the following definition:

CCommonSettings::CCommonSettings(void)
 : CPropertyCollectionPersistent(_T("CommonSettings"), *this)
{
   CPropertyCollectionPersistent::Create(details::SettingAttribute__Enum, 
   _countof(details::SettingAttribute__Enum), false);
}
laune
  • 31,114
  • 3
  • 29
  • 42