3D Charts Will Not Compile in C++ Builder 2009

We are attempting to use a 3D pie chart in class

TAdvChartView3D in one of our VCL based C++ projects under C++ Builder 2009.
There are two problems with this attempt:

1) An Open GL compiler error is generated in OpenGL.hpp after adding the following line to the top of the code module: #include <AdvChartView3D.hpp>. Note that <gl/gl.h> and <gl/glu.h> are included in the lines previous to your 3D include. The error that is generated by the compiler is: [BCC32 Error] Opengl.hpp(115): E2040 Declaration terminated incorrectly. The offending line is "static const Word GL_MAX_LIGHTS = 0xd31;" which looks harmless. If I rename "GL_MAX_LIGHTS" to "GL_MAX_LIGHTS2", then the problem moves on to issue number 2 below.

2) After fudging with OpenGL.hpp, then the following compiler errors are generated in your header files (Note that function overloads with different return types is not allowed in C++ - Functions must be named differently):

[BCC32 Error] Advopenglutil.hpp(162): E2356 Type mismatch in redeclaration of '_fastcall VectorAdd(const float *,const float *)'

[BCC32 Error] Advopenglutil.hpp(161): E2344 Earlier declaration of '_fastcall VectorAdd(const float *,const float *)'

[BCC32 Error] Advopenglutil.hpp(164): E2356 Type mismatch in redeclaration of '_fastcall VectorSubtract(const float *,const float *)'

[BCC32 Error] Advopenglutil.hpp(163): E2344 Earlier declaration of '_fastcall VectorSubtract(const float *,const float *)'

[BCC32 Error] Advopenglx.hpp(165): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(166): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(167): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(168): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(169): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(170): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(171): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(172): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(173): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(174): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(175): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(176): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(177): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(178): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(179): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(180): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(181): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(182): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(183): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(184): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(185): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(186): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(187): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(188): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(189): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(190): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(191): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(192): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(193): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(194): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(195): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(196): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(197): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(198): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(199): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(200): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(201): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(202): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(203): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(204): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(205): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(206): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(207): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(208): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(209): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(210): E2040 Declaration terminated incorrectly

[BCC32 Error] Advopenglx.hpp(210): E2228 Too many error or warning messages


To reproduce this:

Create a new project in C++ Builder 2009 and drop a TAdvChartView3D onto the form. Try to compile. Note that there are several issues with OpenGL.hpp. Manually include <gl/gl.h> and <gl/glu.h>. There will now be only one issue with OpenGL.hpp. Rename "GL_MAX_LIGHTS" to "GL_MAX_LIGHTS2". Now there will be issues with the ADV chart headers.

Additional notes: Tried a new project in XE2 and it did not generate any OpenGL.hpp compiler errors. However, it still generated a compiler error in your modules, same as in 2009.

This needs to work for C++ Builder 2009. What needs to be done?

Hi, 


We have investigated this here and have applied a fix for this, the next version will address this issue.

Kind Regards, 
Pieter

Hi Pieter,


I'm facing the same problem as Pollack Jack  (TAdvChartView3D Opengl.hpp compilers problem  under C++ Builder 2009). 

I'm using TMS Advanced Charts last version (3.8.1.4 - TAdvChartView3D version 1.0.2.1 OCT, 2014) and it seems the problem persists. Has it been fixed yet?

Thank you and best regards.

Hi, 


This issue was fixed in v3.8.1.2. Are you sure you are compiling with the latest version?
Perhaps you could download the latest version 3.8.1.5 and remove all old related files (.hpp, .obj, .dcu, ....) manually before installing.

Kind Regards, 
Pieter

Hi Pieter,


I've read that in your changelog. I was using 3.8.1.4 version installed from scratch (no previous version installed in development machine) but i downloadded 3.8.1.5 version, remove previous  components (Components->Install packages->Remove) and uninstall TMS Advanced Charts using your uninstaller, reboot and install the new version. The very same problem occurs. Nothing has changed.

Any ideas?

Kind regards.

can you perhaps manually clean your hpp/bpl/dcp folders that might contain old chart related files that are not automatically removed via the uninstaller? These folders can be found under C:\Users\Public\Documents\RAD Studio\6.0 (which is the default directory for Rad Studio 2009).


Kind Regards, 
Pieter

Did you also follow the first steps in manually patching OpenGL.hpp:


"1) An Open GL compiler error is generated in OpenGL.hpp after adding the following line to the top of the code module: #include <AdvChartView3D.hpp>. Note that <gl/gl.h> and <gl/glu.h> are included in the lines previous to your 3D include. The error that is generated by the compiler is: [BCC32 Error] Opengl.hpp(115): E2040 Declaration terminated incorrectly. The offending line is "static const Word GL_MAX_LIGHTS = 0xd31;" which looks harmless. If I rename "GL_MAX_LIGHTS" to "GL_MAX_LIGHTS2", then the problem moves on to issue number 2 below."

I checked that folders and i've not found chart related files.

Hi, 

I've followed the steps described in the previous message (include gl.h and glu.h before AdvChartView3D.hpp) and change GL_MAX_LIGHTS to GL_MAX_LIGHTS2 in OpenGL.hpp. After that, when I compile, IDE throws the next errors

[BCC32 Error] Advopenglx.hpp(165): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(166): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(167): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(168): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(169): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(170): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(171): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(172): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(173): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(174): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(175): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(176): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(177): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(178): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(179): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(180): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(181): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(182): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(183): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(184): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(185): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(186): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(187): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(188): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(189): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(190): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(191): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(192): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(193): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(194): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(195): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(196): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(197): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(198): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(199): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(200): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(201): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(202): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(203): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(204): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(205): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(206): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(207): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(208): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(209): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(210): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(211): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(212): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(213): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(214): E2040 Declaration terminated incorrectly
[BCC32 Error] Advopenglx.hpp(214): E2228 Too many error or warning messages.

the first offending line is
static const ShortInt GL_NO_ERROR = 0x0;

Any tips?

Thank you.

Hi, 


We have investigated this here and are currently uploading a new version. Can you please try again with version 3.8.1.6 as soon as its available?

Kind Regards, 
Pieter

Hi Pieter


Thank you for your support.

I've downloaded the new version and these are the results:

Test 1. New project, drop component y compile without modification
Result: IDE throws compile error -> [BCC32 Error] Opengl.hpp(62): E2257 , expected.
First offending line: typedef PFNGLARRAYELEMENTEXTPROC TGLARRAYELEMENTEXTPROC;

Test 2. Include gl.h and glu.h before your header.
Result: IDE throws compile error.
[BCC32 Error] Opengl.hpp(115): E2040 Declaration terminated incorrectly -> Offending Line static const Word GL_MAX_LIGHTS = 0xd31;

Test 3. Rename GL_MAX_LIGHTS to GL_MAX_LIGHTS2 in OpenGLhpp and compile again.
Result. Finally IDE compiles project without any warning.

Now I've got a couple of questions regarding this issue.
1. I'm worried about future weird / unexpected problems regarding GL_MAX_LIGHTS renaming in hpp header without modify any pascal source file and recompile
2. Is it your final patch or you'll make a new version which avoids the need of manual GL_MAX_LIGHTS  rename and inclusion of gl.h and glu.h in our headers?

Thank you for your support.

Hi, 


OpenGL.hpp file is a file that is distributed in C++Builder 2009. Unfortunately we are unable to modify this file. This file will need to be patched manually. The problem is also described here. It's unclear if modifying this file will have effects on other components, but that's also something that we cannot verify from our side. We will investigate here if we can further improve this, but this is a workaround that is needed when combined with the latest version of the TMS Advanced Charts. 

We haven't had any reports or issues with newer versions of C++Builder.

Kind Regards, 
Pieter

Pieter Scheldeman2015-02-06 10:58:48

Thank you Pieter for your patience and support.