Hi, I have my project set up using Visual Studio 2022. My platform toolset is set to LLVM (clang-cl) and the include path is set correctly. My code for now looks something like this:
If this is still a problem, it would be helpful to say which libraries you already include in your link. I was able to get the posted code to link cleanly (using link.exe not lld-link) with LLVMCore.lib, LLVMSupport.lib, LLVMRemarks.lib, LLVMBinaryFormat.lib, and LLVMBitstreamReader.lib.
Thanks for your reply, by adding the libraries you mentioned I was able to make two of the errors go away, but I still get a "undefined symbol ‘LLVMContext’ " error (LNK2001). I have tried adding every library prefixed ‘LLVM’ to the list but this did not fix the error.
Please post the entire error message, and ideally the full command line that gets the error. As I said the posted example works for me, so I’m not able to reproduce your problem at this point.
CodeGen::context refers to my LLVMContext variable which is inside my CodeGen class:
class CodeGen {
public:
static llvm::LLVMContext context;
Edit: It appears that removing the error wasn’t related to LLVM. One of my AST classes was statically accessing the context like this: CodeGen::context Removing this line also fixes the error.