[cfe-dev] How do I output to the console in Windows using clang++?

Sean McBeth daedalic at gmail.com
Fri Nov 18 15:11:14 PST 2011


This seems like it should be simple, but I've run into quite a few problems
with this. I first tried using cout from <iostream.h>, only to find out
that llvm does not seem to support it. Then I tried using raw_ostream and
the outs function, and now I'm getting an unresolved external error:
"LLVM ERROR: Program used external function '_ZN4llvm4outsEv' which ciuld
not be resolved!"
Stack dump:
0.   Program arguments: lli test.bc
1.   Running pass: 'x86 Machine Code Emitter' on function '@main'

To get the compiler to recognize outs, I had to modify the includes in
raw_ostream.h to find a couple of files properly.

Here is the code I'm using:

#include "llvm/include/llvm/Support/raw_ostream.h"

int main ()
{
    llvm::outs() << "HELLO WORLD";
}

I've gotten code to run just fine without using any library functions.

Any help would be much appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111118/a312d7da/attachment.html>


More information about the cfe-dev mailing list