Originally, the problem is the lack of .cpp file. Then I noticed the compilation log is not showing the .o file being generated for the non-pass classes.<div><br></div><div>Then I added the .cpp files for each .h file, then the .o files are being generated, shown in the Debug directory. Actually, if I add "VERBOSE = 1" in the Makefile, it shows the linking command is actually linking all the .o files into the pass.so file.</div>
<div><br></div><div>Any help will be appreciated.</div><div><br></div><div>Thanks!</div><div>Welson</div><div><br><div><div><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 6:45 AM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 2/29/12 11:03 PM, Welson Sun wrote:
    <blockquote type="cite">
      
      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?</blockquote>
    <br></div>
    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.<br>
    <br>
    Classes should be declared in header files and have their methods
    defined in .cpp files.  That's the easiest way to fix the problem.<br>
    <br>
    -- John T.<div class="im"><br>
    <br>
    <blockquote type="cite">
      <div>
        <br>
      </div>
      <div>Thanks,</div>
      <div>Welson</div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div></div>

<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Welson<div><br></div><div>Phone: (408) 418-8385</div><div>Email:  <a href="mailto:welson.sun@gmail.com" target="_blank">welson.sun@gmail.com</a></div><div>
<br></div><br>
</div></div></div>