{"id":1012,"date":"2024-03-14T08:00:00","date_gmt":"2024-03-14T07:00:00","guid":{"rendered":"https:\/\/www.fuhselab.de\/?p=1012"},"modified":"2024-07-24T06:17:36","modified_gmt":"2024-07-24T04:17:36","slug":"g-der-c-compiler","status":"publish","type":"post","link":"https:\/\/www.fuhselab.de\/index.php\/2024\/03\/14\/g-der-c-compiler\/","title":{"rendered":"G++: Der C++ Compiler"},"content":{"rendered":"\n<p>Dieser Artikel zeigt die Installation des Compilers und bietet eine kleine Einf\u00fchrung in C++&#8230;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Der C++ Compiler \u201cg++\u201d wird ben\u00f6tigt, wenn man sich mit C++ Programmierung besch\u00e4ftigt und die selbst geschriebenen Codes auch lokal ausf\u00fchren und testen m\u00f6chte. Der Compiler wandelt den Code in Maschinensprache, also in Nullen und Einsen um. Dieser Artikel zeigt die Installation des Compilers und bietet eine kleine Einf\u00fchrung in C++.<\/p>\n\n\n\n<p><strong>Installation des Compilers<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo apt install g++<\/li>\n<\/ul>\n\n\n\n<p><strong>Einf\u00fchrung in C++<\/strong><\/p>\n\n\n\n<p>Der Code wird mit einem gew\u00f6hnlichen Texteditor geschrieben und als cpp-Datei abgespeichert.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include\n\nint main()\n\n{\n\nstd::cout &lt;&lt; \u201eHallo Welt!\u201c &lt;&lt;\n\nstd::endl;\n\nstd:: cin.get();\n\nreturn 0;\n\n}<\/code><\/pre>\n\n\n\n<p>Nun geht es ins Terminal\u2026Die gerade erzeugte Datei (hier hallo.cpp) wird nun mit folgendem Terminalbefehl kompiliert..<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>g++ hallo.cpp<\/li>\n<\/ul>\n\n\n\n<p>Durch den Compiler wird nun eine out-Datei erzeugt. Der Name der Output-Datei kann \u00fcbrigens auch gleich mit angegeben werden.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>g++ -o Dateiname.out Dateiname.cpp<\/li>\n<\/ul>\n\n\n\n<p><strong>C++ Programm im Terminal ausf\u00fchren<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>.\/Dateiname.out<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Dieser Artikel zeigt die Installation des Compilers und bietet eine kleine Einf\u00fchrung in C++&#8230;<\/p>\n","protected":false},"author":1,"featured_media":791,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[21],"class_list":["post-1012","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux-gruppe-peine"],"_links":{"self":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/comments?post=1012"}],"version-history":[{"count":2,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1012\/revisions"}],"predecessor-version":[{"id":1690,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1012\/revisions\/1690"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media\/791"}],"wp:attachment":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media?parent=1012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/categories?post=1012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/tags?post=1012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}