identifier "CefInitialize" is undefined

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

identifier "CefInitialize" is undefined

Postby JohnConnor » Fri Apr 14, 2017 7:04 am

Hello,

I've just composed the simple app, but for some reasons the CefInitialize method is not reachable for me. I've checked several example in the cefSimple, but it still a mystery how it gets resolved. I must be referencing something that is not necessary here...

My code as follows:
Code: Select all
#include "WpfApp.h"
#include "include\cef_sandbox_win.h"
#include <iostream>

int main() {

   CefSettings settings;
   void* sandbox_info = NULL;

   CefBrowserSettings bsettings;
   
   CefRefPtr<WpfApp> client(new WpfApp);
   CefMainArgs main_args;
   CefScopedSandboxInfo scoped_sandbox;
   sandbox_info = scoped_sandbox.sandbox_info();

   CefInitialize(main_args, settings, client.get(), sandbox_info);


The call to CefInitialize is unknown. If I click F12 it navigates properly here....
I am using VS 2015.
Any thoughts what is missing here?
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: identifier "CefInitialize" is undefined

Postby Czarek » Fri Apr 14, 2017 7:10 am

You need to link with libcef_dll_wrapper library.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: identifier "CefInitialize" is undefined

Postby JohnConnor » Fri Apr 14, 2017 7:24 am

I am liked to the following libs:
Code: Select all
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
libcef.lib
libcef_dll_wrapper.lib
comctl32.lib
rpcrt4.lib
shlwapi.lib
ws2_32.lib
cef_sandbox.lib
dbghelp.lib
psapi.lib
version.lib
winmm.lib

I'v literally copied the setup from simpleapp. Checked additional library directories and I got the following here:
Code: Select all
C:\cef_binary\libcef_dll_wrapper\Debug
C:\cef_binary\Debug


Also - tried playing with the libs and includes here and still get the same.
CefRunMessageLoop(); also gives me the same error for some reasons.
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: identifier "CefInitialize" is undefined

Postby Czarek » Fri Apr 14, 2017 7:39 am

Are you including cef_app.h header file? What is the exact error message?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: identifier "CefInitialize" is undefined

Postby JohnConnor » Fri Apr 14, 2017 7:46 am

That was it! cef_app.h was not included. doh!
Thanks!
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: identifier "CefInitialize" is undefined

Postby JohnConnor » Fri Apr 14, 2017 8:08 am

Ok. Now I can build, but I get this when trying to execute CefInitialize:
Code: Select all
Unhandled exception at 0x10C2DE34 (libcef.dll) in Zz_Test.exe: 0xC0000005: Access violation writing location 0x00000000.


full test code look as follows:
Code: Select all
#include "include\cef_sandbox_win.h"
#include <iostream>
#include "WpfApp.h"
#include "include\cef_app.h"

int main() {

   CefSettings settings;
   void* sandbox_info = NULL;

   CefBrowserSettings bsettings;
      
   CefRefPtr<WpfApp> client(new WpfApp);
   CefMainArgs main_args;
   CefScopedSandboxInfo scoped_sandbox;
   sandbox_info = scoped_sandbox.sandbox_info();

   CefInitialize(main_args, settings, client.get(), sandbox_info); // ERROR POPS DURING EXECUTION

   CefWindowInfo windowInfo;
   CefBrowserHost::CreateBrowser(windowInfo, client, CefString("http://www.google.com"), bsettings, NULL);

   CefRunMessageLoop();
}


It does not state any where in the documentation where to run it so I am just running in on the main console application thread.
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: identifier "CefInitialize" is undefined

Postby Czarek » Fri Apr 14, 2017 8:15 am

I don't know if you can run CEF as a console application.
Try to obtain a stack trace, you will need a .pdb file, download debug/release symbols from: http://opensource.spotify.com/cefbuilds/index.html
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: identifier "CefInitialize" is undefined

Postby JohnConnor » Fri Apr 14, 2017 8:25 am

Ok. What if I try to run this offscreen? I mean without the actual window. basically - I am only trying to setup the bare minimum for the app to run. (window display is the next step)
My app only implements the following for now:

Code: Select all
class WpfApp:
   public CefClient,
   public CefRenderHandler,
   public CefLifeSpanHandler,
   public CefApp


So it does not quiet do much. I am trying to work on this as it goes by adding more and more on top of the existing features.

I could of course switch application type to Win32 if that would make sense, but the goal is still the same - start the chrome with minimal requirements. Latter on I would hook up all this into some Wpf window and display stuff there. but for now I'd just like to get it running in the background.

By the way - the error states the following: "invalid file descriptor to ICU data received" ;] - any idea where to start looking?
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: identifier "CefInitialize" is undefined

Postby JohnConnor » Wed Apr 19, 2017 1:27 am

Managed to fix this by moving the required files from the resource directory to debug directory where the exe file is. Also had copy bunch of other files as they were also required.
Eveyrthing works fine now (Initialization, browser creation), but it fails to run message loop. Can not properly debug as it required libcef.dll.pdb file. I've downloaded it and tried to browse during debug mode, but VS still sais that matching symbol file was not found. I've also tied putting it in the same dir as libcef.dll and libcef.lib files are located - no joy. I guess I might need the source of the lib.. or I must be doing something really wrong.
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 58 guests