Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5964187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:23:10+00:00 2026-05-22T19:23:10+00:00

I created a templated data class ( CAnyData , please see its header file

  • 0

I created a templated data class (CAnyData, please see its header file copy for your reference), with which I declared some variables in my another class (CConstantDataBlock, please see its header file copy for your reference). As you may see, the latter one is nearly an empty class. But when I compiled my project, the VS2008 compiler thowed the following linking errors. Would please help me figure out what’s wrong with my CConstantDataBlock and/or CAnyData?

1>------ Build started: Project: Tips, Configuration: Debug Win32 ------
1>Compiling...
1>ConstantDataBlock.cpp
1>Linking...
1>   Creating library F:\Tips\Debug\Tips.lib and object F:\Tips\Debug\Tips.exp
1>ConstantDataBlock.obj : error LNK2019: unresolved external symbol "public: __thiscall CAnyData<double>::~CAnyData<double>(void)" (??1?$CAnyData@N@@QAE@XZ) referenced in function __unwindfunclet$??0CConstantDataBlock@@QAE@XZ$0
1>ConstantDataBlock.obj : error LNK2019: unresolved external symbol "public: __thiscall CAnyData<int>::~CAnyData<int>(void)" (??1?$CAnyData@H@@QAE@XZ) referenced in function __unwindfunclet$??0CConstantDataBlock@@QAE@XZ$0
1>ConstantDataBlock.obj : error LNK2019: unresolved external symbol "public: __thiscall CAnyData<double>::CAnyData<double>(void)" (??0?$CAnyData@N@@QAE@XZ) referenced in function "public: __thiscall CConstantDataBlock::CConstantDataBlock(void)" (??0CConstantDataBlock@@QAE@XZ)
1>ConstantDataBlock.obj : error LNK2019: unresolved external symbol "public: __thiscall CAnyData<int>::CAnyData<int>(void)" (??0?$CAnyData@H@@QAE@XZ) referenced in function "public: __thiscall CConstantDataBlock::CConstantDataBlock(void)" (??0CConstantDataBlock@@QAE@XZ)
1>F:\Tips\Debug\Tips.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://f:\Tips\Tips\Debug\BuildLog.htm"
1>Tips - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#pragma once

#include <string>

using namespace std;

template <class T>
class CAnyData
{
public:
    CAnyData(void);
    CAnyData(int nWordNumber, string sContents, T Type, int nWidth, int nPrecision);
    ~CAnyData(void);

// Operators
    CAnyData( const CAnyData& rhs );
    const CAnyData& operator = (const CAnyData& rhs);

    // Must define less than relative to name objects.
    bool operator<( const CAnyData& AnyData ) const;

    // Compares profile's of two objects which represent CAnyData
    inline bool operator ==(const CAnyData& rhs) const;

// Get properties  
    inline int WordNumber() const { return m_nWordNumber; }
    inline const string& Contents() const { return m_sContents; }
    inline const T& DataType() const { return m_Type; }
    inline int Width() const { return m_nWidth; }
    inline int Precision() const { return m_nPrecision; }

// Set properties
    void WordNumber(int nWordNumber) const { m_nWordNumber = nWordNumber; }
    void Contents(string sContents) const { m_sContents = sContents; }
    void DataType(T Type) const { m_Type = Type; }
    void Width(int nWidth) const { m_nWidth = nWidth; }
    void Precision(int nPrecision) const { m_nPrecision = nPrecision; }

protected:
    void Init(void);

protected:
    int m_nWordNumber;
    string m_sContents;
    T m_Type;
    int m_nWidth;
    int m_nPrecision;
};

#pragma once

#include "AnyData.h"

// Constants block
// This block consists of 64 words to be filled with useful constants.

class CConstantDataBlock
{
public:
    CConstantDataBlock(void);
    ~CConstantDataBlock(void);

protected:
    CAnyData<int>    m_nEarthEquatorialRadius;
    CAnyData<int>    m_nNominalSatelliteHeight;
    CAnyData<double> m_dEarthCircumference;
    CAnyData<double> m_dEarthInverseFlattening;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:23:11+00:00Added an answer on May 22, 2026 at 7:23 pm

    It seems that you do not have definitions for several of the methods of CAnyData, including the default constructor and the destructor. When you use these in your CConstantDataBlock-class, the constructor and destructor are required though.

    Since CAnyData is a class-template, all definitions should be written directly into the header-file (just as you have done with all the getters and setters).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a class which holds data of type and returns an vector on
I created an entry template for data which is repeated several times. Now I
I defined this data structure: class Foo(db.Model): created = db.DateTimeProperty(required = True) In the
I created an iPhone project using the Core Data template. Now when I try
Is there some trick that I'm missing here? I've created a templated control, very
I created a site template from a basic site which was itself created from
I've created a small tool which is used to process binary files. All the
I would like to write an object generator for a templated RAII class --
Following an example in Accelerated C++ , I created a custom STL container, which
I have created an attached property to extend a Button class with additional state:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.