[LLVMdev] Tutorial 1: casting cout

Scott Ricketts sricketts at maxentric.com
Tue May 12 11:16:47 PDT 2009


To get Tutorial 1 to compile, I had to cast cout as a raw_osstream, as in:

PM.add(createPrintModulePass(&llvm::cout));

---->

PM.add(createPrintModulePass((raw_ostream*)&llvm::cout));


I was getting the following error:

$ c++ -g tut1.cpp `llvm-config --cxxflags --ldflags --libs core` -o tut1
tut1.cpp: In function ‘int main(int, char**)’:
tut1.cpp:19: error: cannot convert ‘llvm::OStream*’ to
‘llvm::raw_ostream*’ for argument ‘1’ to ‘llvm::ModulePass*
llvm::createPrintModulePass(llvm::raw_ostream*, bool)’

Anyway, just wanted to mark the record in case this is a bug in the
tutorial or an inconsistency with the revision of llvm I am running
(71457). Still, it is likely that the error is a result of me
overlooking something.




More information about the llvm-dev mailing list