Unresolved external errors while using TList in C++ - clang

I have the following linker errors when compiling a project using bcc32c (Embarcadero):
It looks like he is not finding the library VCL.
[ilink32 Error] Error: Unresolved external 'System::__linkproc__
__fastcall LStrAsg(System::AnsiStringT&, System::AnsiStringT)
referenced from ...DEBUG\VCLE.LIB|System_t_win32
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrCat(System::AnsiStringT&, System::AnsiStringT)
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrCat3(System::AnsiStringT&, System::AnsiStringT)
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrClr(void *) referenced from ...
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrCmp()
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrDelete(System::AnsiStringT&, int, int) referenced
from ...
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrFromArray(System::AnsiStringT&, char *, int,
unsigned short) referenced from
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall LStrFromPChar(System::AnsiStringT&, char *, unsigned
short) referenced from...
[ilink32 Error] Error: Unresolved external System::__linkproc__
__fastcall StrFromUStr(System::AnsiStringT&,System::UnicodeString,
unsigned short) referenced from...

The problem is that the linker can not resolve the VCL class references.
Insert in your project a VCL C++ Form.
Right click on the project and Add New->VCL Form C++ Builder
It is not necessary to save the unit.h/.cpp.
You can in sequence delete the form from your project. This is only necessary for the link to be created
Embarcadero put in your .cbproj the code FrameworkType = VCL.
<PropertyGroup>
<ProjectGuid>{xxxx}/ProjectGuid>
<ProjectVersion>XX.Y</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
The problem must be solved.

Related

Indy 10 compilation fails with FASTMM compiler directive enabled

I'm using Delphi 7. I downloaded the latest version of Indy (10.5462) from Fulgan's page yesterday.
There is a batch file (Full_d7.bat) which normally compiles Indy successfully.
Now if I DEFINE USE_FASTMM4 in IdCompilerDefines.inc in Core, Protocols and System directory, the following error is given back on compilation:
IdGlobal.pas(2229) Error: Declaration of 'GetBytes' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetCharCount' differs from declaration
in interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetChars' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(2229) Error: Declaration of 'GetString' differs from declaration in
interface 'IIdTextEncoding'
IdGlobal.pas(3500) Error: Incompatible types: 'Char' and 'Integer'
IdGlobal.pas(3502) Error: Incompatible types: 'Char' and 'Integer'
IdGlobal.pas(3527) Error: Incompatible types: 'Byte' and 'Char'
IdGlobal.pas(3592) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3594) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3617) Error: Incompatible types
IdGlobal.pas(3620) Error: Incompatible types: 'Word' and 'Char'
IdGlobal.pas(3663) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3665) Error: Incompatible types: 'Char' and 'Byte'
IdGlobal.pas(3687) Error: Incompatible types: 'Word' and 'Char'
Is this a bug in the D7 edition or I'm missing something? Is there something maybe that needs to be defined as well in the config file when using FastMM?
FastMM declares its own version of several Delphi native data types (Native(U)Int, (U)IntPtr, etc) when supporting older compilers that do not have those types available.
However, it is also declaring PByte in all Delphi versions prior to D2009, which it should NOT be doing (since PByte is available in the RTL's System unit going all the way back to at least Delphi 5). That redeclaration of PByte is interfering with Indy's use of PByte in the IdGlobal unit - but only in Delphi versions prior to D2006 (as Indy does not use FastMM directly in later Delphi versions).
I have checked in a patch for Indy to address this (SVN rev 5463), and filed a bug report with FastMM.

E2065 Unsatisfied forward or external Declaration

I am working on 64 bit migration of 32 bit Delphi project.
While using C obj file I was getting errors which are solved by answer provided in the question link:
Bad object file formate
But after using the answers provided by David and Rudy.
I have resolved the issue but now I am getting some other errors:
[dcc64 Error] xxx.dpr(936): E2065 Unsatisfied forward or external declaration: '__GSHandlerCheck'
[dcc64 Error] xxx.dpr(936): E2065 Unsatisfied forward or external declaration: '__security_cookie'
[dcc64 Error] xxx.dpr(936): E2065 Unsatisfied forward or external declaration: '__security_check_cookie'
[dcc64 Error] xxx.dpr(936): E2065 Unsatisfied forward or external declaration: '__imp_free'
[dcc64 Error] xxx.dpr(936): E2065 Unsatisfied forward or external declaration: '__imp_malloc'
I am not able to see any traces of these functions.
Can anyone help me on this?

E2003 Undeclared identifier: 'IntToStr'

Try to print index in popup of showmessage gives an compile time error.
[dcc32 Error] Unit.pas(57): E2003 Undeclared identifier: 'IntToStr'
In my code I am using ShowMessage(IntToStr(J)); J is an integer.
You have to add the SysUtils unit to your calling unit's uses clause.

How to link statically a Delphi procedure in a C++Builder project

I want to link statically a Delphi function from a C++Builder source. I added the .pas file to the C++Builder project. I tried the following declarations:
In Delphi:
procedure SayHi; stdcall;
In C++Builder:
extern "C" {
void __stdcall SayHi();
}
All modules compile fine, but when I link it I get the following error:
[ilink64 Error] Error: Unresolved external 'SayHi' referenced from C:\DEV\PACKSWAP\WIN64\DEBUG\MAIN.O
What am I missing?
When you compile a .pas file in a C++Builder project, an .hpp header file is automatically created that you can then #include in your C++ code where needed. There is no need to declare the function manually.
The linker error is due to your use of extern "C" on the C++ side. That is affecting how the C++ compiler emits name mangling/decoratation for that function, so it does not match the name mangling/decoration that the Delphi compiler emits. That is why the linker cannot find the function implementation. Remove the extern "C" and then both compilers should emit the same name mangling/decoration to allow the linker to match them up.

TImage Uses dxGDIPlusClasses.dcu

I've used the trial of DevExpress but it's expired. Now when I add a standard TImage and try to compile it gives me the error:
[dcc32 Fatal Error] filter.pas(9): F1026 File not found: 'dxGDIPlusClasses.dcu'
Any help appreciated.

Resources