Page 1 of 1

g++ without std lib?

Posted: Mon Oct 08, 2007 10:32 am
by david-h
I`m currently trieing to compile my kernel under Ubuntu, but I have some problems with my C++ compiler. It always tries to integrate the libstdc++, and I get undefined reference to... error from the linker.
I tried to find a command line option to exclude the standard library, but I could neither find one in g++`s help nor with Google.

Is here anyone who knows hoe to compile a file with c++ without the C++ standard library?

Posted: Mon Oct 08, 2007 11:58 am
by os64dev
check the wiki for the correct command line and otherwise build a cross-compiler, which is also in the wiki.
General note read before you post. (i cannot believe you searched properly)

Posted: Tue Oct 09, 2007 2:48 am
by JamesM
-nostdlib will stop libstdc++ from being linked.

It works on my ubuntu system.

My flags:

Code: Select all

-I. -I./common/ -I./fs -I./memory/ -I./process -I./utilities/ \
        -fno-builtin -fno-exceptions -fno-rtti -fno-stack-protector -m32 -nostartfiles \
        -nostdlib -DKERNEL
Remember that you must set these as CXXFLAGS, not CFLAGS. That could be your problem.

JamesM

Posted: Tue Oct 09, 2007 8:54 am
by david-h
I think my mistake was the thing with the CXXFLAGS, it works now. I tried it so many times before I asked, it didn`t work. Now I have tried it one time and it works!
It`s really weird sometimes...

Thanks :)