Latest CEF4Delphi and C++Builder

Post Reply
emsystems
Posts: 2
Joined: Tue Aug 10, 2021 7:16 pm

Latest CEF4Delphi and C++Builder

Post by emsystems »

I have previously used CEF4Delphi in a C++Builder project that I had built in Tokyo. I have updated that project to Sydney 10.4.2 and decided to update CEF4Delphi to the latest version. I downloaded CEF4Delphi that uses CEF 92.0.25 which includes Chromium 92.0.4515.131. and installed compeonents with no issue. SimpleBrowse2 demo project compiles fine with Delphi and runs with no problems.

I ported the project to C++Builder. When I try to compile it. I get the following error:

[bcc32 Error] SimpleBrowser2.cpp(14): E2015 Ambiguity between 'Ucefapplication::GlobalCEFApp' and 'Ucefapplicationcore::GlobalCEFApp'

in this code:
try
{
GlobalCEFApp = new TCefApplication();
GlobalCEFApp->IgnoreCertificateErrors = true;
if( GlobalCEFApp->StartMainProcess() )
{
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
GlobalCEFApp->Free();
GlobalCEFApp = NULL;
}

Thanks,
Elias
User avatar
salvadordf
Posts: 3067
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Latest CEF4Delphi and C++Builder

Post by salvadordf »

Hi,

I'm not a C++ builder expert and I don't even have a license to use it but perhaps you can avoid that problem if you move the GlobalCEFApp variable declaration to a new unit.

At this moment, GlobalCEFApp is declared in two units : ucefapplication.pas and ucefapplicationcore.pas

Delete those 2 declarations and move it to uCEFTypes.pas or to a new unit.
petko
Posts: 47
Joined: Sun Jul 02, 2017 9:58 am

Re: Latest CEF4Delphi and C++Builder

Post by petko »

I just create a local variable by disambiguating it first and use it instead of the global variable:

Code: Select all

TCefApplication* cefApp = Ucefapplication::GlobalCEFApp;
emsystems
Posts: 2
Joined: Tue Aug 10, 2021 7:16 pm

Re: Latest CEF4Delphi and C++Builder

Post by emsystems »

I commented out the line in uCEFApplicationCore.hpp. That resolved the problem.

Thanks
Post Reply