Borland C++ unit/component linker error... wtf?

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

SouL-FirE
Posts: 2
Joined: 2003-11-11 23:06

Borland C++ unit/component linker error... wtf?

Post by SouL-FirE » 2003-11-11 23:22

Well, most of you people most likely use VS/.NET and possible cant figure out what the error might be.

Description

At the moment ths small command does absolutly nothing but the nothingness wont work. When i call the function SaveAll(); its supposed to just open a file, nothing more, but it doesnt. Ok here is the code

XMLFunctions.cpp

Code: Select all

#pragma hdrstop

#include "XMLFunctions.h"
#include "Main.h"
#pragma package(smart_init)

void SaveAll()
{
XMLDoc->FileName = "Settings.xml";
}


XMLFunctions.h

Code: Select all

//---------------------------------------------------------------------------
#ifndef XMLFunctionsH
#define XMLFunctionsH
#include <msxmldom.hpp>
#include <XMLDoc.hpp>
#include <xmldom.hpp>
#include <XMLIntf.hpp>

extern TXMLDocument *XMLDoc;
extern void SaveAll();

//---------------------------------------------------------------------------
#endif


Just as that it compiles and the program works, but as soon as i assign tha function to an event I get a compiler error.

event such as

Code: Select all

void __fastcall TMainForm::SaveSettingsClick(TObject *Sender)
{
SaveAll();      // This dont fucking work!!!       
}


i get this error compiling

[Linker Error] Unresolved external '_XMLDoc' referenced from F:\DCNET\HUBSERVER\V1.0.6\SOURCE\XMLFUNCTIONS.OBJ

any ideas? im all clueless

PS :: first time i have used this board so sorry if i have started this thread in teh wrong place :wink:
SouL-Fire
AKA :: «§øüL¤Fí®ê»
AKA :: Xa3r0

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-08 02:46
Location: .pa.us

Re: Borland C++ unit/component linker error... wtf?

Post by GargoyleMT » 2003-11-12 00:03

SouL-FirE wrote:

Code: Select all

#include <XMLDoc.hpp>


i get this error compiling

[Linker Error] Unresolved external '_XMLDoc' referenced from F:\DCNET\HUBSERVER\V1.0.6\SOURCE\XMLFUNCTIONS.OBJ


:) Well, I'll try to provide general programming advice.

I looked around, but I couldn't find much information on what XMLDoc.hpp belongs to. This turned up... The class seems pretty basic. Is it something you downloaded somewhere? If so, you'll need to add XMLDoc.cpp to your project. Otherwise, you probably need to figure out which library it belongs to so that you can let the linker know about it by passing it the relevent command line switch.

SouL-FirE
Posts: 2
Joined: 2003-11-11 23:06

Post by SouL-FirE » 2003-11-20 19:55

ok this seems to like compiling, altho i get a EAccessViolation Error when teh program is running

XML_ApplicationSettings.cpp

Code: Select all

//---------------------------------------------------------------------------


#pragma hdrstop

#include "XML_ApplicationSettings.h"
#include "Main.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

void __fastcall IXML_ApplicationSettings::LoadDocument()
{
XMLDoc->FileName = "DCNet_ApplicationSettings.xml";
XMLDoc->Active = true;
}

AnsiString __fastcall IXML_ApplicationSettings::Get_Version()
{
_di_IXMLNode Node = XMLDoc->DocumentElement->ChildNodes->GetNode(0);
AnsiString Version = Node->ChildNodes->Nodes[WideString("ApplicationSettings")]->Attributes[WideString("Version")];
return Version;
}


XML_ApplicationSettings.h

Code: Select all

//---------------------------------------------------------------------------

#ifndef XML_ApplicationSettingsH
#define XML_ApplicationSettingsH
#include <XMLDoc.hpp>

class IXML_ApplicationSettings {
public:
        void __fastcall LoadDocument();

        AnsiString __fastcall Get_Version();
        AnsiString __fastcall Get_Optim();
        AnsiString __fastcall Get_Left();
        AnsiString __fastcall Get_Top();

        AnsiString __fastcall Set_Left(int Value);
        AnsiString __fastcall Set_Top(int Value);

        TXMLDocument *XMLDoc;
};
//---------------------------------------------------------------------------
#endif


any ideas now?
SouL-Fire
AKA :: «§øüL¤Fí®ê»
AKA :: Xa3r0

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-08 02:46
Location: .pa.us

Post by GargoyleMT » 2003-11-20 21:16

SouL-FirE wrote:ok this seems to like compiling, altho i get a EAccessViolation Error when teh program is running


:) First, are you running the program from within the compiler? It should stop and give you a nice way of examining all the variables when it crashes... an access violation sounds like you have a pointer that's corrupted and pointing at memory that your program doesn't own.

Who is online

Users browsing this forum: Google [Bot] and 0 guests