[LLVMdev] bc file only with llvm-gcc3?
Anton Korobeynikov
asl at math.spbu.ru
Thu Sep 18 05:54:22 PDT 2008
> I was only using the C++ standard lib. It doesn't need to be linked
> because it's only a header. Better said, it can't be linked with the std
> lib, never heard that it's needed to link it.
Your program does need to have libstdc++ to linked it.
> Btw the code compiles and runs for sure with a g++ and also with llvm-g++.
Right, because they provide all needed extra magic libraries to linker.
This will surely fail for you:
g++ foo.cpp -o foo.o
gcc foo.o
> Only the converted C output contains still references to C++. How can I
> remove them?
You cannot, since you're compiling C++ sources and using C++ standard
library. You've mentioned this explicitly before:
> There is an error, gcc complaints about undefined
> reference to std::cout and such (the code was just a very small
> example with cout).
Once again: you have C source code but with calls to C++ standard
library (just as normal C calls). Thus you need to link libstdc++ in!
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
More information about the llvm-dev
mailing list