Linker error on VS 2015

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.

Linker error on VS 2015

Postby harnekmanj » Mon May 08, 2017 5:21 pm

Hi,

I downloaded the binaries cef_binary_3.2987.1597.gffc5773_windows32 file and extracted it on my local. Then I ran the cmake command to build the sln file for 2015. By default the "Runtime Library" setting for all the projects is "Multi-threaded (/MT)", but I need to change that to "Multi-threaded Debug DLL (/MDd)" as our application uses that setting when running in debug mode. But when I run the build for CEF solution, it fails with the linker errors "_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in simple_app.obj"

But if I generate the sln file using the same source for 2012, the default for "Runtime Library" setting for all the projects is "Multi-threaded Debug (/MTd)" and if I change that to "Multi-threaded Debug DLL (/MDd)", it builds fine.

I am trying to understand why the VS2015 gets a different runtime library setting by default and how can I get the solution build with "Multi-threaded Debug DLL (/MDd)".

Thanks in advance.
harnekmanj
Techie
 
Posts: 14
Joined: Fri Nov 27, 2015 8:23 pm

Re: Linker error on VS 2015

Postby HarmlessDave » Mon May 08, 2017 8:24 pm

I wonder if the binary builds are now using the "official" directive even for the debug builds. With that flag set the "debug" build uses /MT instead of /MTd. See USE_OFFICIAL_BUILD_SANDBOX in cmake > cef_variables.cmake.

Building from source I needed to remove the "official" flag for the debug build, and then hack cef_variables.cmake.

It might make sense to set up the scripting for builds so that the "official" flag only applies to Release, or offer a "official-release" flag that only applies to Release. My guess is most people want their Debug build to use /MTd.

You might look at the debug files with Dumpbin /Directives to see how they were built.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Linker error on VS 2015

Postby amaitland » Mon May 08, 2017 8:37 pm

I've had no problems building 3.2987.1601 with VS2013 and VS2015 using /MDd for Debug and /MD for Release builds of the wrapper.

CI build log is https://ci.appveyor.com/project/cefshar ... 57.0.0-CI9 if your interested.

You can download the Nuget packages from https://www.nuget.org/packages/cef.sdk/ if you like (just a zip file you can extract the libs from if your not using Nuget in your app)
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Linker error on VS 2015

Postby JohnConnor » Wed May 10, 2017 8:08 am

Since you are attempting to build the C++ project - I would suggest checking other cefSimple projet settings. There is more to that error that you are getting. I had the same problem as you so ended up mirroring settings from CefSimple project to the new project I created. There are quiet some setup required if you want to start using cef in a new project and linking libfec.lib and libcef_dll_wrapper.lib is not enough. There is quiet some other libs required for the solution to work so to be on a safe side - just mirror the settings from example projects.
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: Linker error on VS 2015

Postby harnekmanj » Wed May 10, 2017 6:00 pm

Thanks for your input.

But the problem I am facing is with the CEF and JCEF project settings itself and its only with the VS 2015. If there was flag or binary issue then it should be for all the different VS version, but in this case its just for VS 2015.

So just to be more clear, I am running cmake command for generating VS 2012 and VS 2015 project files. Its just the VS 2015 which has the default "MT" setting and if I change that to "MDd" the build just fails, but for VS 2012 its all fine as the default setting is "MTd".
harnekmanj
Techie
 
Posts: 14
Joined: Fri Nov 27, 2015 8:23 pm

Re: Linker error on VS 2015

Postby harnekmanj » Fri May 12, 2017 7:50 pm

So I made a change in the cef_variables.cmake file, where it was checking for MSVC_VERSION

I updated the 1900 to 1910. But by doing this change it makes the USE_SANDBOX OFF, which I am not sure how it affects the usage of CEF. Could somebody please let me know what could be the issues.

It does resolve my initial problem.

if(OS_WINDOWS)
# Configure use of the sandbox.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900) // I updated this to 1910. But by doing this change it makes the USE_SANDBOX OFF, which I am not sure how it affects the usage of CEF.
# The cef_sandbox.lib static library is currently built with VS2015. It will
# not link successfully with other VS versions.
set(USE_SANDBOX OFF)
endif()

# Configure use of official build compiler settings.
# When using an official build the "Debug" build is actually a Release build
# with DCHECKs enabled. In order to link the sandbox the Debug build must
# be configured with some Release-related compiler settings.
option(USE_OFFICIAL_BUILD_SANDBOX "Enable or disable use of an official build sandbox." ON)
if(NOT USE_SANDBOX)
# Don't need official build settings when the sandbox is off.
set(USE_OFFICIAL_BUILD_SANDBOX OFF)
endif()
harnekmanj
Techie
 
Posts: 14
Joined: Fri Nov 27, 2015 8:23 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 74 guests