[LLVMdev] Linking problem in a pass

John Criswell criswell at illinois.edu
Thu Mar 1 06:45:10 PST 2012


On 2/29/12 11:03 PM, Welson Sun wrote:
> My pass uses another class which is defined in a separate .h file, 
> which sits in the same folder as the pass .cpp file. The pass compiles 
> fine, but when using the pass "opt -load ...", there is an error: opt 
> symbol lookup error  .... undefined symbol xxx,  where xxx is the 
> class name. It looks like that class file's object file is not linked 
> into the pass.so file. How should I change the Makefile to make the 
> linking happen?

If your .cpp file isn't including the .h file, then the class in the .h 
file isn't being compiled and, therefore, isn't being included in the 
final library file.

Classes should be declared in header files and have their methods 
defined in .cpp files.  That's the easiest way to fix the problem.

-- John T.

>
> Thanks,
> Welson
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120301/8c50422f/attachment.html>


More information about the llvm-dev mailing list