CefInitialize LNK2001 Unresolved external symbol error

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.

CefInitialize LNK2001 Unresolved external symbol error

Postby ymer » Sun Apr 25, 2021 7:52 pm

Hello!

I'm trying to getting started with CEF and now I'm stucked. I know that here were several same threads like mine on that forum, but I tried everything (except building CEF from sources) and still getting the same error.

I already have tried two binary versions of CEF:
https://cef-builds.spotifycdn.com/index.html#windows64 and https://cef-builds.spotifycdn.com/index.html#windows32. x64 version builds each target fine, while x32 fails on cefsimple, but successfuly builds libcef_dll_wrapper. (both cef_binary_90.5.9+gd330790+chromium-90.0.4430.85)

On x64 binary it builds cefsimple fine, but once I move libcef_dll_wrapper.lib to my application includes folder, it fails with this message:
Code: Select all
Ошибка   LNK2019   ссылка на неразрешенный внешний символ "bool __cdecl CefInitialize(class CefMainArgs const &,class CefStructBase<struct CefSettingsTraits> const &,class scoped_refptr<class CefApp>,void *)" (?CefInitialize@@YA_NABVCefMainArgs@@ABV?$CefStructBase@UCefSettingsTraits@@@@V?$scoped_refptr@VCefApp@@@@PAX@Z) в функции _main.   ConsoleApplication1   C:\Users\Юзер\source\repos\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   


I have tried to use absolutely empty project:
Code: Select all
#include <iostream>

#include "include/cef_app.h"

using namespace std;

#pragma comment(lib, "../../include/libcef.lib")
#pragma comment(lib, "../../include/libcef_dll_wrapper.lib")

int main()
{
   CefMainArgs args;
   CefSettings settings;

   CefInitialize(args, settings, nullptr, nullptr);
}


and it still throws exception on CefInitialize as above one.

Can you please tell me where I'm wrong? I spent on it the day, but nothing worked :(
Will appreciate any help!
ymer
Newbie
 
Posts: 5
Joined: Sun Apr 25, 2021 7:37 pm

Re: CefInitialize LNK2001 Unresolved external symbol error

Postby magreenblatt » Sun Apr 25, 2021 9:36 pm

What VS version are you using? You should build libcef_dll_wrapper as part of your application build (it needs the same compiler settings). See https://bitbucket.org/chromiumembedded/ ... rc/master/
magreenblatt
Site Admin
 
Posts: 10859
Joined: Fri May 29, 2009 6:57 pm

Re: CefInitialize LNK2001 Unresolved external symbol error

Postby ymer » Mon Apr 26, 2021 3:22 am

Hello magreenblatt! Thank you for your reply.

I'm using VS16 (2019)
I've tried to use same build settings as my app does, but still same error occurs

Here is build settings from cef:
Code: Select all
/ifcOutput "libcef_dll_wrapper.dir\Release\" /GS /GL /W3 /wd"4100" /wd"4127" /wd"4244" /wd"4481" /wd"4512" /wd"4701" /wd"4702" /wd"4996" /Gy /Zc:wchar_t /I"C:\Games\cef\cef_binary_90.5.9+gd330790+chromium-90.0.4430.85_windows64" /Zi /Gm- /O2 /sdl- /Fd"libcef_dll_wrapper.dir\Release\libcef_dll_wrapper.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "__STDC_CONSTANT_MACROS" /D "__STDC_FORMAT_MACROS" /D "_WIN32" /D "UNICODE" /D "_UNICODE" /D "WINVER=0x0601" /D "_WIN32_WINNT=0x601" /D "NOMINMAX" /D "WIN32_LEAN_AND_MEAN" /D "_HAS_EXCEPTIONS=0" /D "PSAPI_VERSION=1" /D "CEF_USE_SANDBOX" /D "CEF_USE_ATL" /D "_NDEBUG" /D "WRAPPING_CEF_SHARED" /D "CMAKE_INTDIR=\"Release\"" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /Fa"libcef_dll_wrapper.dir\Release\" /EHsc /nologo /Fo"libcef_dll_wrapper.dir\Release\" /Fp"libcef_dll_wrapper.dir\Release\libcef_dll_wrapper.pch" /diagnostics:column


And here is one my app use:
Code: Select all
/ifcOutput "C:\Users\Юзер\source\repos\DXFont\DXFont\.obj\GTASA\Release\" /GS /GL /analyze- /W3 /wd"4100" /wd"4127" /wd"4244" /wd"4481" /wd"4512" /wd"4701" /wd"4702" /wd"4996" /Gy /Zc:wchar_t /I"C:\Dev\plugin-sdk\plugin_sa\" /I"C:\Dev\plugin-sdk\plugin_sa\game_sa\" /I"C:\Dev\plugin-sdk\shared\" /I"C:\Dev\plugin-sdk\shared\game\" /I"C:\Games\cef\cef_binary_90.5.9+gd330790+chromium-90.0.4430.85_windows32" /Zi /Gm- /O2 /sdl- /Fd"C:\Users\Юзер\source\repos\DXFont\DXFont\.obj\GTASA\Release\vc142.pdb" /Zc:inline /fp:precise /D "_NDEBUG" /D "_CRT_SECURE_NO_WARNINGS" /D "_CRT_NON_CONFORMING_SWPRINTFS" /D "GTASA" /D "GTAGAME_NAME=\"San Andreas\"" /D "GTAGAME_ABBR=\"SA\"" /D "GTAGAME_ABBRLOW=\"sa\"" /D "GTAGAME_PROTAGONISTNAME=\"CJ\"" /D "GTAGAME_CITYNAME=\"San Andreas\"" /D "_DX9_SDK_INSTALLED" /D "PLUGIN_SGV_10US" /D "PLUGIN_SGV_10EU" /D "PLUGIN_SGV_11US" /D "PLUGIN_SGV_11EU" /D "PLUGIN_SGV_SR2" /D "PLUGIN_SGV_SR2LV" /D "_WINDLL" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /Fa"C:\Users\Юзер\source\repos\DXFont\DXFont\.obj\GTASA\Release\" /EHsc /nologo /Fo"C:\Users\Юзер\source\repos\DXFont\DXFont\.obj\GTASA\Release\" /Fp"C:\Users\Юзер\source\repos\DXFont\DXFont\.obj\GTASA\Release\DXFont.SA.pch" /diagnostics:column


Can you look at them? Did I miss something?
ymer
Newbie
 
Posts: 5
Joined: Sun Apr 25, 2021 7:37 pm

Re: CefInitialize LNK2001 Unresolved external symbol error

Postby ymer » Mon Apr 26, 2021 12:42 pm

magreenblatt wrote:What VS version are you using? You should build libcef_dll_wrapper as part of your application build (it needs the same compiler settings). See https://bitbucket.org/chromiumembedded/ ... rc/master/


Tried to move "libcef_dll_wrapper" project into my solution, nothing worked. :/
ymer
Newbie
 
Posts: 5
Joined: Sun Apr 25, 2021 7:37 pm

Re: CefInitialize LNK2001 Unresolved external symbol error

Postby ymer » Tue Apr 27, 2021 4:43 am

Finally figured out.
I have cloned the repo you've provided above and it finally worked! Thanks
ymer
Newbie
 
Posts: 5
Joined: Sun Apr 25, 2021 7:37 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 19 guests