LLVM Module Pass problem!

Dear All,

I am new to LLVM and try to write a Module pass. In the same .cpp file I am defining a class.
The problem is that whenever I instantiate an object from the class I get the following error while running the pass:

opt: symbol lookup error: …/llvm/Debug/lib/MyPass.so: undefined symbol: _ZN10Thread_MyPassC1Ev

The pass is compiled correctly but does not run. Could you someone please let me know what is wrong?

Thanks in advance,
::Saman

Saman Zonouz wrote:

Dear All,

I am new to LLVM and try to write a Module pass. In the same .cpp file
I am defining a class.
The problem is that whenever I instantiate an object from the class I
get the following error while running the pass:

opt: symbol lookup error: ../llvm/Debug/lib/MyPass.so: undefined
symbol: _ZN10Thread_MyPassC1Ev

The pass is compiled correctly but does not run. Could you someone
please let me know what is wrong?

Are the methods of your class defined within the same .cpp file or in
another .cpp file? It appears that your pass is referencing those
methods but that they are not included within MyPass.so.

-- John T.

Thanks John, the problem was that the constructor was not defined. That fixed the prob.
::Saman