C++ Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Creature (talk | contribs)
Added compiler options.
Creature (talk | contribs)
Added source tags
Line 200: Line 200:
The options for g++ are slightly different than when building a C kernel.
The options for g++ are slightly different than when building a C kernel.


<source lang="bash">
<pre>
g++ -o main.o -c kernel.cpp -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-rtti -fno-stack-protector
g++ -o main.o -c kernel.cpp -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-rtti -fno-stack-protector
</pre>
</source>


The reasons why most of these are disabled is because they usually require runtime support (which you in a basic kernel don't have). For a more thorough explanation, see the [[C++]] article. There is also an article about the [[GCC_Stack_Smashing_Protector|stack smashing protector]] if you want to enable --stack-protector.
The reasons why most of these are disabled is because they usually require runtime support (which you in a basic kernel don't have). For a more thorough explanation, see the [[C++]] article. There is also an article about the [[GCC_Stack_Smashing_Protector|stack smashing protector]] if you want to enable --stack-protector.