Jorge A. Navas
2012-Jan-23 23:55 UTC
[LLVMdev] Use printing methods of third-party libraries that use std::ostream
Hi all, I need to use the printing methods from a third-party library. The problem is those methods use std::cout but the use of std::ostream methods seems to be disabled in latest versions of LLVM. I'm aware of raw_os_ostream (http://llvm.org/doxygen/classllvm_1_1raw__os__ostream.html) which takes a std::ostream as input. E.g., I could do something like: #include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_ostream.h" raw_os_ostream * rout = new raw_os_ostream(std::cout); // 1 // From now on, use rout rather than std::cout // 2 The problem is that I get the error just with line 1 alone: undefined symbol: _ZTVN4llvm14raw_os_ostreamE What I am doing wrong? How can use the printing methods of my third-party library? P.S. Just in case, I use clang and llvm 3.0 in a linux machine. Many thanks! Jorge
Berkin
2012-Jan-30 22:46 UTC
[LLVMdev] Use printing methods of third-party libraries that use std::ostream
I have exactly same problem. Did you find any solutions?
Duncan Sands
2012-Jan-31 09:28 UTC
[LLVMdev] Use printing methods of third-party libraries that use std::ostream
Hi Jorge,> I need to use the printing methods from a third-party library. The > problem is those methods use std::cout but the use of std::ostream > methods seems to be disabled in latest versions of LLVM. > > I'm aware of raw_os_ostream > (http://llvm.org/doxygen/classllvm_1_1raw__os__ostream.html) which > takes a std::ostream as input. E.g., I could do something like: > > #include "llvm/Support/raw_os_ostream.h" > #include "llvm/Support/raw_ostream.h" > > raw_os_ostream * rout = new raw_os_ostream(std::cout); // 1 > // From now on, use rout rather than std::cout // 2 > > The problem is that I get the error just with line 1 alone: > > undefined symbol: _ZTVN4llvm14raw_os_ostreamEdid you link with libLLVMSupport? Ciao, Duncan.> > What I am doing wrong? How can use the printing methods of my > third-party library? > > P.S. Just in case, I use clang and llvm 3.0 in a linux machine. > > Many thanks! > > Jorge > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Jorge A. Navas
2012-Jan-31 10:01 UTC
[LLVMdev] Use printing methods of third-party libraries that use std::ostream
On Tuesday, January 31, 2012 at 10:28:36 (+0100), Duncan Sands wrote:>> Hi Jorge, >> >> > I need to use the printing methods from a third-party library. The >> > problem is those methods use std::cout but the use of std::ostream >> > methods seems to be disabled in latest versions of LLVM. >> > >> > I'm aware of raw_os_ostream >> > (http://llvm.org/doxygen/classllvm_1_1raw__os__ostream.html) which >> > takes a std::ostream as input. E.g., I could do something like: >> > >> > #include "llvm/Support/raw_os_ostream.h" >> > #include "llvm/Support/raw_ostream.h" >> > >> > raw_os_ostream * rout = new raw_os_ostream(std::cout); // 1 >> > // From now on, use rout rather than std::cout // 2 >> > >> > The problem is that I get the error just with line 1 alone: >> > >> > undefined symbol: _ZTVN4llvm14raw_os_ostreamE >> >> did you link with libLLVMSupport? >>I didn't. I do now and it solves the problem. Thanks! Jorge>> Ciao, Duncan. >> >> > >> > What I am doing wrong? How can use the printing methods of my >> > third-party library? >> > >> > P.S. Just in case, I use clang and llvm 3.0 in a linux machine. >> > >> > Many thanks! >> > >> > Jorge >> > _______________________________________________ >> > LLVM Developers mailing list >> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Maybe Matching Threads
- [LLVMdev] Use printing methods of third-party libraries that use std::ostream
- [LLVMdev] Converting raw_ostream to std::ostream
- [LLVMdev] Reading IR from a std::ostream
- [LLVMdev] raw_os_ostream: symbol not found
- [LLVMdev] std::cout << *MyModule does not work anymore