Linker problem

Hello, I have a problem when try to compile
console application. I'm using TNMSMTP and TIniFile.
When I uncheck Options->"Build with runtimes Library"
I have this erros:
[Linker Error] Unresolved external 'System::__linkproc__ __fastcall LStrClr(void *)' referenced from C:PROGRAM FILESBORLANDCBUILDER6LIBRELEASEVCLE.LIB|dstring
[Linker Error] Unresolved external 'Inifiles::TIniFile::' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external '__fastcall Inifiles::TIniFile::~TIniFile()' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external '__fastcall System::TObject::~TObject()' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external 'System::__linkproc__ __fastcall LStrAsg(void *, const void *)' referenced from C:PROGRAM FILESBORLANDCBUILDER6LIBRELEASEVCLE.LIB|dstring
[Linker Error] Unresolved external '__fastcall Inifiles::TCustomIniFile::TCustomIniFile(const System::AnsiString)' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external 'Nmsmtp::TNMSMTP::' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external '__fastcall Nmsmtp::TNMSMTP::TNMSMTP(Classes::TComponent *)' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external '__fastcall Sysutils::DiskFree(unsigned char)' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external '__fastcall Sysutils::DiskSize(unsigned char)' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ
[Linker Error] Unresolved external 'System::__linkproc__ __fastcall LStrSetLength()' referenced from C:PROGRAM FILESBORLANDCBUILDER6LIBRELEASEVCLE.LIB|dstring
[Linker Error] Unresolved external 'System::__linkproc__ __fastcall LStrFromPChar(System::AnsiString&, char *)' referenced from C:PROGRAM FILESBORLANDCBUILDER6LIBRELEASEVCLE.LIB|dstring
[Linker Error] Unresolved external '__fastcall Nmsmtp::TNMSMTP::SendMail()' referenced from C:PROGRAM FILESBORLANDCBUILDER6PROJECTSFREEDISKSPACEDOSSENDMAIL.OBJ



The full source code is:
//---------------------------------------------------------------------------
#include
#include
#include



#pragma hdrstop


struct ALPHABET
{
char c;
};
ALPHABET alphabet[]=
{
'0','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};

//extern "C" __declspec(dllexport) System::__linkproc__ __fastcall LStrClr(void *);
//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{

TIniFile * ini = new TIniFile( "SendMail.ini" );
TNMSMTP * smtpMail = new TNMSMTP(NULL);

smtpMail->Host = ini->ReadString( "MAIL", "Host", "smtp.online.bg" );
smtpMail->Port = ini->ReadInteger( "MAIL", "Port", 25 );
smtpMail->UserID = ini->ReadString( "MAIL", "UserID", "yiliev@fideliobg.com" );
smtpMail->PostMessageA->FromAddress = ini->ReadString( "MAIL", "FromAddress", "test" );
smtpMail->PostMessageA->Subject = ini->ReadString( "MAIL", "Subject", "test");
smtpMail->PostMessageA->ToAddress->Add( ini->ReadString( "MAIL", "ToAddress", "yiliev@fideliobg.com" ) );
smtpMail->PostMessageA->ToCarbonCopy->Add( ini->ReadString( "MAIL", "ToCopy", "yulian_iliev@yahooo.com" ) );

long disk = ini->ReadInteger( "DISK", "DiskNumber", 0 );

__int64 AmtFree = DiskFree(disk);
__int64 Total = DiskSize(disk);
AnsiString S;

S = ini->ReadString( "MAIL", "Header", "Header" );
smtpMail->PostMessageA->Body->Add( S );
smtpMail->PostMessageA->Body->Add( "" );

S.sprintf("%I64d percent of the space on DRIVE %c is free: %I64d MB", AmtFree*100/Total,alphabet[disk], (AmtFree/1024)/1024 );
smtpMail->PostMessageA->Body->Add( S );
smtpMail->PostMessageA->Body->Add( "" );

S = ini->ReadString( "MAIL", "Footer", "Footer" );
smtpMail->PostMessageA->Body->Add( S );

try
{
if( ! smtpMail->Connected )
{
smtpMail->Connect();
}

}
catch(...)
{
return 0;
}

if( smtpMail->Connected )
{
smtpMail->SendMail();
smtpMail->Disconnect();
}


return 1;
}
//--------------------------------------------------

Any kind of help is appreciate!

Comments

  • Did you try to disable dynamic RTL as well?
  • : Did you try to disable dynamic RTL as well?

    If you mean Option->Linker->Use Dynamic RTL.
    Yes. This options is unchecked.
  • This post has been deleted.
  • : : Did you try to disable dynamic RTL as well?
    :
    : If you mean Option->Linker->Use Dynamic RTL.
    : Yes. This options is unchecked.
    :

    I found out how to solve this problem.
    I have to create a instance of TDataModule class like this
    //----------------------------------
    #include
    #include "iostream.h"

    //Include TDatamludle file
    #include "DM.h"
    #include "SysUtils.hpp"


    #pragma hdrstop

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

    #pragma argsused
    int main(int argc, char* argv[])
    {

    TIniFile * ini = new TIniFile( "SendMail.ini" );
    //create instance of TDataMoudle
    TDM1 * DM1 = new TDM1(NULL);
    //SMTP is instance of TNMSMTP
    DM1->SMTP->Host = ini->ReadString( "MAIL", "Host", "" );
    DM1->SMTP->Port = ini->ReadInteger( "MAIL", "Port", 0 );
  • : : : Did you try to disable dynamic RTL as well?
    : :
    : : If you mean Option->Linker->Use Dynamic RTL.
    : : Yes. This options is unchecked.
    : :
    :
    : I found out how to solve this problem.
    : I have to create a instance of TDataModule class like this
    : //----------------------------------
    : #include
    : #include "iostream.h"
    :
    : //Include TDatamludle file
    : #include "DM.h"
    : #include "SysUtils.hpp"
    :
    :
    : #pragma hdrstop
    :
    : //-------------------------------------------------------------------
    : -----
    :
    : #pragma argsused
    : int main(int argc, char* argv[])
    : {
    :
    : TIniFile * ini = new TIniFile( "SendMail.ini" );
    : //create instance of TDataMoudle
    : TDM1 * DM1 = new TDM1(NULL);
    : //SMTP is instance of TNMSMTP
    : DM1->SMTP->Host = ini->ReadString( "MAIL", "Host", "" );
    : DM1->SMTP->Port = ini->ReadInteger( "MAIL", "Port", 0 );
    :
    Hello!!!
    I have that problem.

    What it has "DM.h"?

    Thanks,
    Lucas.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories