TurboPack / SynEdit

SynEdit is a syntax highlighting edit control, not based on the Windows common controls.
216 stars 72 forks source link

Installation of Synedit component under C++ Builder leads to error #213

Open matdev2022 opened 2 years ago

matdev2022 commented 2 years ago

When I try to install Synedit using Getit, I get an error message during the installation:

synedit synedit-2 Unable to open file 'designide.bpi'. However, this happens only for the Win64 version of the SynEditCR project. The 32bit version is installed without problems.

If a new 32 bit - project is created and the SynEdit main component is put on a new form, an error occurs when compiling the project:

SynDWrite.hpp: unknown type name '_di_IDWriteFactory'.

Thereupon I have cloned the Synedit project with Fork and made the following adjustments:

SynDWrite.pas line 135 {$EXTERNALSYM IDWriteFactory} was commented out. Then the missing type was generated in SysDWrite.hpp.

153

In order to solve the error during the installation of the component, I have made the following changes:

Project: SynEditCD280.bpl The 64 bit version was removed as the target platform.

Project: SynEditCR280.bpl The 32 and 64 bit version still exist as target platforms. The required BPI, designide.bpi and designideresources.bpi were removed.

Since I have almost no knowledge of Delphi, I do not know if the changes I have made are OK, but everything works for me now. I have tested the changes with the C++ Builder 11.1 Professional.

ogsadmin commented 2 years ago

Thanks for sharing - I had a similar issue here. I managed to get it working (based your hints, thanks), but also digged out the actual reason (see below).

For me, installing the current version from GetIt (SynEdit VCL 2022.03) finished successfully (after using the correct version for C++Builder, see #216), but using it (drop a TSynEdit onto a form and build) failed with a similar error: image

Strange thing was, that the missing type _di_IDWriteFactory was correctly declared in Winapi.D2D1.hpp (which is correctly included from SynDWrite.hpp), but still not recognized by the Alexandria 11.1 CLang 32 compiler. Also funny that -click jumps to the declaration, so CodeInsight seems to resolve the symbol, whereas the clang compiler does not...

This made me look a bit more into the details - and I stumbled over the missing namespace decoration in the generated SynDWrite.hpp file. Although the lines before and after the error use the full namespace qualifier Winapi::D2d1::, the error line does not (even though it is defined in the same Winapi.D2D1.hpp and thus in the same namespace): image

So the correct fix is to add the namespace prefix and voila, it builds: image

I am not deep into the Delphi world, too, but to me it smells like the hpp generator has a bug.

ogsadmin commented 2 years ago

FYI: I've filed a bug report with embarcadero: https://quality.embarcadero.com/browse/RSP-37899.