g++ without std lib?

Programming, for all ages and all languages.
Post Reply
david-h
Posts: 17
Joined: Sun Apr 08, 2007 5:48 am
Location: Frankfurt/Main, Germany
Contact:

g++ without std lib?

Post 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?
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post 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)
Author of COBOS
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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
david-h
Posts: 17
Joined: Sun Apr 08, 2007 5:48 am
Location: Frankfurt/Main, Germany
Contact:

Post 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 :)
Post Reply