Unresolved external Pgaccess::TPgConnection::SetPortW

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
akm
Posts: 13
Joined: Mon 16 Apr 2007 01:01
Contact:

Unresolved external Pgaccess::TPgConnection::SetPortW

Post by akm » Wed 11 Feb 2009 05:14

Hello

This is small code example

Code: Select all

Unit1.h
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include 
#include 
#include 
#include 
#include 
#include "DBAccess.hpp"
#include "PgAccess.hpp"
#include 
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TEdit *edUsername;
	TEdit *edPassword;
	TEdit *edPort;
	TUpDown *udPort;
	TComboBox *cbDatabase;
	TButton *bOk;
	TButton *bCancel;
	TLabel *lblUsername;
	TLabel *lblPassword;
	TLabel *lblServer;
	TLabel *lblDatabase;
	TLabel *lblPort;
	TPgConnection *PgConnection1;
	TEdit *edServer;
	void __fastcall bOkClick(TObject *Sender);
	void __fastcall cbDatabaseEnter(TObject *Sender);
	void __fastcall bCancelClick(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

//---------------------------------------------------------------------------
Unit1.cpp
//---------------------------------------------------------------------------

#include 
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBAccess"
#pragma link "PgAccess"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{

}
//---------------------------------------------------------------------------
void __fastcall TForm1::bOkClick(TObject *Sender)
{
	PgConnection1->Username = edUsername->Text;
	PgConnection1->Password = edPassword->Text;
	PgConnection1->Server	= edServer->Text;
	PgConnection1->Port		= udPort->Position;
	PgConnection1->Database = cbDatabase->Text;
	PgConnection1->Connected = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::cbDatabaseEnter(TObject *Sender)
{
if (!cbDatabase->Items->Count)
{
	PgConnection1->Username = edUsername->Text;
	PgConnection1->Password = edPassword->Text;
	PgConnection1->Server	= edServer->Text;
	PgConnection1->Port		= udPort->Position;
	PgConnection1->Database = "template1";
	PgConnection1->GetDatabaseNames(cbDatabase->Items);
	PgConnection1->Connected = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::bCancelClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------

And RAD 2009 Cbuilder coud not link with error

[ILINK32 Error] Error: Unresolved external '__fastcall Pgaccess::TPgConnection::SetPortW(int)' referenced from C:\CBPRJ\PGCONNECT\DEBUG\UNIT1.OBJ

When I comment

Code: Select all

//PgConnection1->Port		= udPort->Position;
Everething OK

Any suggestion?????

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 11 Feb 2009 13:04

Add the following line:

#undef SetPort

before

#include "PgAccess.hpp"

to resolve the problem.

In the next build of PgDAC we'll add this line to PgAccess.hpp.

Post Reply