How do I output to the console in Windows using clang++?

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!

I got it working using <stdio.h>. However some insight into getting the llvm library functions to work in windows would be helpful. Thanks!


It is llvm issue rather than clang. please subscribe llvmdev, too.