I am compiling with clang and linking to LLVM and it works in debug mode on -O0 but when I turn on optimizations I get:
Main-21ab48.o : error LNK2001: unresolved external symbol "public: void __cdecl llvm::cfg::Update<class llvm::BasicBlock *>::dump(void)const " (?dump@?$Update@PEAVBasicBlock@llvm@@@cfg@llvm@@QEBAXXZ)
Main-21ab48.o : error LNK2001: unresolved external symbol "public: void __cdecl llvm::cfg::Update<class llvm::BasicBlock *>::dump(void)const " (?dump@?$Update@PEAVBasicBlock@llvm@@@cfg@llvm@@QEBAXXZ)
I am using LLVM 15 and I compiled it myself. I found this definition in CFGUpdate.h
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const { print(dbgs()); }
#endif
I tried removing the header guards but that didn't help. Defining NDEBUG did but I am afraid that might be disabling some optimizations.