Fix for Rio U2 clang compile errors - C++ Builder

TMS VCL Chart package 4.4.0.0 will not compile in clang in Rio update 2 for C++ Builder. It might compile in classic 32 bit, if you are lucky, but your application will blow up on exit. If you are experiencing these problems, like we were, and you are getting errors like the below errors in clang, then read on for a work around:


[bcc64 Error] AdvOpenGLX.hpp(168): conflicting types for 'glAreTexturesResident'
  gl.h(1154): previous declaration is here
[bcc64 Error] AdvOpenGLX.hpp(172): conflicting types for 'glBitmap'
  gl.h(1158): previous declaration is here
[bcc64 Error] AdvOpenGLX.hpp(175): conflicting types for 'glCallLists'
  gl.h(1161): previous declaration is here
[bcc64 Error] AdvOpenGLX.hpp(654): functions that differ only in their return type cannot be overloaded
  wingdi.h(6209): previous declaration is here

The problem is caused by Embarcadero generating a bad HPP header for TMS Advanced Charts for C++ Builder. Follow these instructions to get your project back on track (at least as well as it can be with the extremely buggy C++ Builder Rio lol):

1) Open file for 32bit: AdvOpenGLX.hpp

2) Comment out all lines starting with ?extern ?C??. These functions exist in gl.h and the linker will find them and the compiler is happy without the externs.

3) Repeat for 64 bit.

4) Clang/classic should now compile and run. This also fixed the issue with classic blowing up when exiting the application.

Following the above solved our problem with 32bit classic blowing up on close, and solved the issue with Clang not compiling. I don't know if there are other problems, but at least we are running again.

Thank me later :)

Thanks for sharing all these details Anthony.
We hope at the same time that Embarcadero will also address this.