Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (WinAPI, Konsole) » Link-error bei dlls

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
22.08.2005, 12:22 Uhr
DarthDevilous



In einer dll hab ich zwei klassen, CDataReader und CDataReaderFactory, definiert. Hier das wichtigste:

C++:
//DataReader.h

#pragma once

CORE_API class CDataReader
{
public:
    CDataReader(void) { }
    virtual ~CDataReader(void) { }
};

CORE_API class CDataReaderFactory
{
public:
    CDataReaderFactory(void);
    virtual ~CDataReaderFactory(void);
private:
    CDataReaderFactory *pNextFactory;
    static CDataReaderFactory *pFirstFactory;
};

// DataReader.cpp

#include "StdAfx.h"
#include "DataReader.h"

CDataReaderFactory* CDataReaderFactory::pFirstFactory = NULL;

CDataReaderFactory::CDataReaderFactory(void)
{
    pNextFactory = pFirstFactory;
    pFirstFactory = this;
}

CDataReaderFactory::~CDataReaderFactory(void)
{
    if (pFirstFactory = this)
        pFirstFactory = pNextFactory;
    else
    {
        for (CDataReaderFactory *pFactory = pFirstFactory;
            pFactory;
            pFactory = pFactory->pNextFactory)
        {
            if (pFactory->pNextFactory = this)
                pFactory->pNextFactory = pNextFactory;
        }
    }
}



In einer zweiten dll definiere ich zwei weitere klassen, die von diesen beiden abstammen (wieder nur das wichtigste):

C++:
//ObjectReader.h

#pragma once
#include <string>
#include <list>
#include "../Core/Object.h"
#include "../Core/DataReader.h"

namespace ObjectReader
{

    class CObjectReader
    {
    public:
        CObjectReader(void);
        CObjectReader(size_t ulStartIndex);
        virtual ~CObjectReader(void);
        static char* pData;
    };

    class CObjectReaderHead :
        public CObjectReader, public CDataReader
    {
    public:
        CObjectReaderHead(void);
        virtual ~CObjectReaderHead(void);
    };

    class CObjectFileReaderFactory
        : public CDataReaderFactory
    {
    public:
        CObjectFileReaderFactory(void) { }
        virtual ~CObjectFileReaderFactory(void) { }
    };

}

// ObjectReader.cpp

#include "StdAfx.h"
#include "ObjectReader.h"

namespace ObjectReader
{
    /*
     * Die Implementierung ist recht lang, also überspringe sie jetzt. U.a. ist auch definiert:
     */

    char* CObjectReader::pData = NULL;
    CObjectFileReaderFactory thisReader;
}



Beim compilieren des ersten dlls bekomme ich die verdächtigen warnungen:

Code:
DataReader.cpp
c:\Documents and Settings\****\My Documents\Visual Studio Projects\MetaEngine\Core\DataReader.h(13) : warning C4091: '__declspec(dllexport ) ' : ignored on left of 'CDataReader' when no variable is declared
c:\Documents and Settings\****\My Documents\Visual Studio Projects\MetaEngine\Core\DataReader.h(28) : warning C4091: '__declspec(dllexport ) ' : ignored on left of 'CDataReaderFactory' when no variable is declared


Beim zweiten dll bekomme ich dann den link error:

Code:
ObjectReader.obj : error LNK2019: unresolved external symbol "public: __thiscall CDataReaderFactory::CDataReaderFactory(void)" (??0CDataReaderFactory@@QAE@XZ) referenced in function "public: __thiscall ObjectReader::CObjectFileReaderFactory::CObjectFileReaderFactory(void)" (??0CObjectFileReaderFactory@ObjectReader@@QAE@XZ)
ObjectReader.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CDataReaderFactory::~CDataReaderFactory(void)" (??1CDataReaderFactory@@UAE@XZ) referenced in function "public: virtual __thiscall ObjectReader::CObjectFileReaderFactory::~CObjectFileReaderFactory(void)" (??1CObjectFileReaderFactory@ObjectReader@@UAE@XZ)


für das linken benutze ich ein #pragma comment(lib, "...")
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C / C++ (WinAPI, Konsole) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: