I have installed the current stable JEDI Code library in C++ Builder XE3 on Windows 7 x32. It works fine, but only as long as I don't include files like JclFileUtils.hpp which are including JclWin32.hpp. Then I get always the compiler error E2040: "Declaration terminated incorrectly" (in file JclWin32.hpp, line 682, second line in the following code snippet):

#define NetApi32 L"netapi32.dll"
static const System::Int8 CSIDL_PROGRAM_FILESX86 = System::Int8(0x2a);
#define RT_MANIFEST (System::WideChar *)(0x18)

I neither have an idea were this error comes from, nor could I found any hints to this. What could be the cause? Thanks in advance.

有帮助吗?

解决方案

I got help and the solution for this problem. Just replace the static const declaration:

static const System::Int8 CSIDL_PROGRAM_FILESX86 = System::Int8(0x2a);

with this macro definition:

#define CSIDL_PROGRAM_FILESX86 0x2a

其他提示

This is a bug in JclWin32.pas.

In C/C++, the Win32 API declares CSIDL values in Microsoft's shlobj.h header using preprocessor #define statements, eg:

#define CSIDL_PROGRAM_FILESX86 0x002a

After the preprocessor is run and performs #define symbol replacements, the compiler ends up seeing the following invalid declaration in JclWin32.hpp:

static const System::Int8 0x002a = System::Int8(0x2a);

JCL should not be re-declaring CSIDL_PROGRAM_FILESX86 (or any other CSIDL value) at all. It should be either:

  1. using Delphi's own Winapi.ShlObj unit, which already declares CSIDL values.

  2. if not using the Winapi.ShlObj unit, then it should at least be declaring its manual CSIDL values as {$EXTERNALSYM} so they do not appear in the generated JclWin32.hpp file. If needed, JCL can include an {$HPPEMIT '#include <shlobj.h>'} statement to pull in the existing Win32 API declarations for C/C++ projects to use.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top