[LLVMdev] LLVM: C++ -> C
dalej at apple.com
Tue Sep 29 09:48:03 PDT 2009
On Sep 29, 2009, at 9:37 AM, dilas dilas wrote:
> I've read that LLVM can convert from C++ to C code.
It does, but it does not supply a C++ library. You'll need to do
> So I've used it in such a way:
> I'm Windows-user so I used MinGW.
> I employed this file as the test:
> #include <iostream>
> int main(int argc, char* argv)
> return 0;
> result of "llvm-g++ C:\llvm_hello.cpp -o C:\llvm_hellopp.exe" worked
> just fine.
> as a result of "llvm-g++ -O3 -emit-llvm C:\llvm_hello.cpp -c -o C:
> \llvm_hellopp.bc" and
> "llc -march=c C:\llvm_hellopp.bc -o C:\llvm_helloCppToC.c" I
> obtained this charming stuff:
> And after "llvm-gcc C:\llvm_helloCppToC.c -o C:\llvm_helloCppToC.exe"
> I've got:
> "C:\llvm_helloCppToC.c: In function 'main':
> C:\llvm_helloCppToC.c:180: warning:return type of 'main' is not 'int'
> C:\...\Temp/ccfREe4x.o:fake:(.text+0xae): undefined reference to
> C:\...\Temp/ccfREe4x.o:fake:(.text+0xbe): undefined reference to
> collect2: ld returned 1 exit status"
> What I've done wrong?
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev