Search code examples
c++linkerstatic-librariesv8

Embeding V8 in C++ causes "unrecognized external symbol" errors related to libcpp


I am trying to embed v8 into my application (using Visual Studio 2019). First, I built it to x86 (ia32) debug static linked library. I also wanted it to be monolitic. There were some errors, but eventualy I managed and I succesfully built it. I ran v8 test after compiling and the result was good. Next, I wanted to use it, so I included all the necessery header files and linked "v8_monolith.lib" library file. But when I try to compile my application, it gives me a lot (about 4500) of linking errors, precisely "unrecognized external symbol" related to libcpp (e.g. to "__libcpp_debug_function"). I am sure that I properly selected runtime library. I also was trying to recompile it for a few times, but it didn't help. I think that libcpp is working, because I don't have any problems using it.

Here is my args.gn file:

is_debug = true
target_cpu = "x86"
v8_enable_backtrace = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
is_component_build = false
v8_static_library = true
v8_monolithic = true
v8_use_external_startup_data = false

Solution

  • Try adding use_custom_libcxx = false to args.gn, that should help.