Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » VC++ / MFC » Liste Speichern Öffnen

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 ] > 2 <
010
20.05.2005, 15:59 Uhr
GuenniAtWork



Ich habe das jetzt so angepasst.
Ich bekomme jetzt aber lustige Linkerfehler!


Code:

Job.obj : error LNK2005: "public: static class CObject * __stdcall CJob::CreateObject(void)" (?CreateObject@CJob@@SGPAVCObject@@XZ) bereits in CL_InstallPCWizardDlg.obj definiert

Job.obj : error LNK2005: "public: virtual struct CRuntimeClass * __thiscall CJob::GetRuntimeClass(void)const " (?GetRuntimeClass@CJob@@UBEPAUCRuntimeClass@@XZ) bereits in CL_InstallPCWizardDlg.obj definiert

Job.obj : error LNK2005: "class CArchive & __stdcall operator>>(class CArchive &,class CJob * &)" (??5@YGAAVCArchive@@AAV0@AAPAVCJob@@@Z) bereits in CL_InstallPCWizardDlg.obj definiert

Job.obj : error LNK2005: "struct AFX_CLASSINIT _init_CJob" (?_init_CJob@@3UAFX_CLASSINIT@@A) bereits in CL_InstallPCWizardDlg.obj definiert

Debug/CL_InstallPCWizard.exe : fatal error LNK1169: Ein oder mehrere mehrfach definierte Symbole gefunden



Keine Ahnung woran es liegt.
--
Gruß GuenniAtWork
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
011
21.05.2005, 13:57 Uhr
mmc20
puss in boots


sieht aus als wäre ein header doppelt drin, da er ja meldet das die CJob klasse bereits definiert ist, schau mal ob du irgendwo CJob definierst, bzw es doppelt drin hast.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
012
23.05.2005, 09:35 Uhr
GuenniAtWork



Hi,

Ich deklariere CJob in Job.h und definiere CJob nur in Job.cpp

Deklaration

C++:
//Job.h Headerdatei
#pragma once

#include <afxcoll.h>
#include "Globalelements.h"


// CJob-Befehlsziel


class CJob : public CObject
{
    DECLARE_SERIAL (CJob)
public:
    CJob();
    CJob::CJob(const CJob& cop);
    void Serialize(CArchive& ar);
    CJob& CJob::operator=(const CJob& cop);
    virtual ~CJob();
    //Datenelemente
    CString        sJobName;
    int            iJobID;
    TRunApp        tRunApp;
    TFiles        tFiles;
    TEnvVar        tEnvVar;
    TService    tService;
    TLink        tLink;
};

IMPLEMENT_SERIAL (CJob, CObject, 1)

//Variabeln
extern CObArray JobList;

//Funktionen




Definition

C++:
// Job.cpp : Implementierungsdatei
//
#include "stdafx.h"
#include "Job.h"


// CJob

CJob::CJob() //Constructor
{
}

CJob::CJob(const CJob& cop)    //kopier-Constructor
{
    this->sJobName = cop.sJobName;
    this->iJobID = cop.iJobID;
    this->tRunApp = cop.tRunApp;
    this->tFiles = cop.tFiles;
    this->tEnvVar = cop.tEnvVar;
    this->tService = cop.tService;
    this->tLink = cop.tLink;
}

CJob& CJob::operator =(const CJob& cop)
{
    this->sJobName = cop.sJobName;
    this->iJobID = cop.iJobID;
    this->tRunApp = cop.tRunApp;
    this->tFiles = cop.tFiles;
    this->tEnvVar = cop.tEnvVar;
    this->tService = cop.tService;
    this->tLink = cop.tLink;
    return *this;
}

void CJob::Serialize(CArchive& ar)
{
    CObject::Serialize( ar );

    if (ar.IsStoring())
    {
        ar << sJobName << iJobID;
        ar << tRunApp.sAppPath << tRunApp.sAppParam;
        ar << tFiles.iCopyDel << tFiles.sFile << tFiles.sFileDestination;
        ar << tEnvVar.iSysUserVar << tEnvVar.sVarName << tEnvVar.sVarValue;
        ar << tService.sServiceName << tService.iStopDel;
        ar << tLink.sName << tLink.sTargetDestination
            << tLink.sTargetFile << tLink.sHotKey
            << tLink.sDescription << tLink.iWindStyle;
    }
    else
    {
        ar >> sJobName >> iJobID;
        ar >> tRunApp.sAppPath >> tRunApp.sAppParam;
        ar >> tFiles.iCopyDel >> tFiles.sFile >> tFiles.sFileDestination;
        ar >> tEnvVar.iSysUserVar >> tEnvVar.sVarName >> tEnvVar.sVarValue;
        ar >> tService.sServiceName >> tService.iStopDel;
        ar >> tLink.sName >> tLink.sTargetDestination
            >> tLink.sTargetFile >> tLink.sHotKey
            >> tLink.sDescription >> tLink.iWindStyle;
    }
}

CJob::~CJob()
{
}

//Variabeln

CObArray JobList;

// CJob-Memberfunktionen



Ich includiere Job.h in Cl_InstallPCWizard.cpp, weil ich darin zeiger auf die CJob klasse darin erzeuge.



wenn ich das #include "Job.h" weglasse meckert der Compiler, weil er die klasse nicht kennt.
Sobald ich das #include "Job h" hinzufüge meckert der Linker.
Verzwickte sache!
--
Gruß GuenniAtWork
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
013
23.05.2005, 09:47 Uhr
GuenniAtWork



Oh Wunder der Linker ist verstummt!

Ich habe das

C++:
IMPLEMENT_SERIAL (CJob, CObject, 1)



aus der Job.h in die Job.cpp geschrieben.

Danke nochmal für die super Hilfe!!!
--
Gruß GuenniAtWork
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
014
23.05.2005, 15:04 Uhr
mmc20
puss in boots


ja, dort muss das auch hin
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: [ 1 ] > 2 <     [ VC++ / MFC ]  


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: