"Symbol not found" when building with c++ compilers

I’ve been going through OrcV2CBindingsReflectProcessSymbols.c, and noticed something I don’t understand

This example works fine when being built by a c compiler. But when I compile it with c++ compiler, it reports

JIT session error: Symbols not found: [ add, mul ]
Error: Failed to materialize symbols: { (main, { mul_add }) }

despite I already change mul and add linkage to extern "C"

+extern "C" {
 int32_t add(int32_t X, int32_t Y) { return X + Y; }
 int32_t mul(int32_t X, int32_t Y) { return X * Y; }

I’m not sure what I’m missing here, any other places I need to mangle the name?


I met same problem before, And I add extern "C" before every C function and it works. Not sure it will work fro you.

Interesting…, I thought adding extern "C" to both add and mul is suffice

If it is not too much trouble, could you please post your diff? I’ve been stuck on this for days

Sorry, my memory is not clear.

Have you found any solutions? I met this problem again…

I use lli to compile binary file. And it report the same error JIT session error: symbols not found. I was trying to solve it for a whole day.

Unfortunately, no…, still stuck on this