I want to integrate my grammar in antlr4 with llvm to generate llvm IR. I make the example code(Kaleidoscope\Chapter3) in llvm into a antlr program.
Standalone llvm example or antlr4 cpp runtime program works both OK.
My environment: Windows, visual studio 2019, Debug , (Debug DLL in antlr4-runtime, compiled from source.)
However I got the following error message:
Not clue how to fix it.
Severity Code Description File Project Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual struct antlrcpp::Any __cdecl antlr4::tree::AbstractParseTreeVisitor::visit(class antlr4::tree::ParseTree *)" (__imp_?visit@AbstractParseTreeVisitor@tree@antlr4@@UEAA?AUAny@antlrcpp@@PEAVParseTree@23@@Z) referenced in function "void __cdecl work3(void)" (?work3@@YAXXZ) examples\Kaleidoscope\Chapter3_2\antlr_try.obj Kaleidoscope-Ch3_2 1
Link command:
1>Target Link:
1> Using "Link" task from assembly "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Build.CppTasks.Common.dll".
1> Task "Link"
1> All source files are not up-to-date: missing command TLog "W:\ubuntu\llvm7_build\examples\Kaleidoscope\Chapter3_2\Kaleidoscope-Ch3_2.dir\Debug\Kaleidos.BE9FF897.tlog\link.command.1.tlog".
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1812
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX64\x64\link.exe /ERRORREPORT:PROMPT /OUT:"W:\ubuntu\llvm7_build\Debug\bin\Kaleidoscope-Ch3_2.exe" /INCREMENTAL /NOLOGO "antlr4-runtime.lib" ..\..\..\Debug\lib\LLVMCore.lib ..\..\..\Debug\lib\LLVMSupport.lib ..\..\..\Debug\lib\LLVMBinaryFormat.lib psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ..\..\..\Debug\lib\LLVMDemangle.lib kernel32.lib user32.lib gdi32.lib winspool.lib oleaut32.lib comdlg32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"W:/ubuntu/llvm7_build/Debug/bin/Kaleidoscope-Ch3.pdb" /SUBSYSTEM:CONSOLE /STACK:"10000000" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"W:/ubuntu/llvm7_build/Debug/lib/Kaleidoscope-Ch3.lib" /MACHINE:X64 /machine:x64 "Kaleidoscope-Ch3_2.dir\Debug\windows_version_resource.res"
1> "Kaleidoscope-Ch3_2.dir\Debug\antlr_try.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\asts.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\EvalVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmBaseVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmLexer.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmParser.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\toy.obj"
1> Tracking command:
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Tracker.exe /a /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i W:\ubuntu\llvm7_build\examples\Kaleidoscope\Chapter3_2\Kaleidoscope-Ch3_2.dir\Debug\Kaleidos.BE9FF897.tlog /r "W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\ANTLR_TRY.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\ASTS.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\EVALVISITOR.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\MYLLVMBASEVISITOR.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\MYLLVMLEXER.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\MYLLVMPARSER.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\MYLLVMVISITOR.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\TOY.OBJ|W:\UBUNTU\LLVM7_BUILD\EXAMPLES\KALEIDOSCOPE\CHAPTER3_2\KALEIDOSCOPE-CH3_2.DIR\DEBUG\WINDOWS_VERSION_RESOURCE.RES" /b MSBuildConsole_CancelEvent1847db8bdd10464784fa77f132d003d1 /c "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX64\x64\link.exe" /ERRORREPORT:PROMPT /OUT:"W:\ubuntu\llvm7_build\Debug\bin\Kaleidoscope-Ch3_2.exe" /INCREMENTAL /NOLOGO "antlr4-runtime.lib" ..\..\..\Debug\lib\LLVMCore.lib ..\..\..\Debug\lib\LLVMSupport.lib ..\..\..\Debug\lib\LLVMBinaryFormat.lib psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ..\..\..\Debug\lib\LLVMDemangle.lib kernel32.lib user32.lib gdi32.lib winspool.lib oleaut32.lib comdlg32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"W:/ubuntu/llvm7_build/Debug/bin/Kaleidoscope-Ch3.pdb" /SUBSYSTEM:CONSOLE /STACK:"10000000" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"W:/ubuntu/llvm7_build/Debug/lib/Kaleidoscope-Ch3.lib" /MACHINE:X64 /machine:x64 "Kaleidoscope-Ch3_2.dir\Debug\windows_version_resource.res"
1> "Kaleidoscope-Ch3_2.dir\Debug\antlr_try.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\asts.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\EvalVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmBaseVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmLexer.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmParser.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\myllvmVisitor.obj"
1> "Kaleidoscope-Ch3_2.dir\Debug\toy.obj"