snipt

Ctrl+h for KB shortcuts

Bash

Get listings of what G++ optimization flags are enabled at -O{0,1,2,3,9}

parallel 'g++ -c -Q -O{} --help=optimizers > O{}-opts' ::: 0 1 2 3 9
https://snipt.net/embed/cc2b031360561aa906254fd4e26715e7/
https://snipt.net/raw/cc2b031360561aa906254fd4e26715e7/
cc2b031360561aa906254fd4e26715e7
bash
Bash
1
2016-09-22T18:36:17
True
False
False
/api/public/snipt/27777/
get-listings-of-what-g-optimization-flags-are-enabled-at-o01239
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>parallel <span class="s1">&#39;g++ -c -Q -O{} --help=optimizers &gt; O{}-opts&#39;</span> ::: <span class="m">0</span> <span class="m">1</span> <span class="m">2</span> <span class="m">3</span> 9 </span></pre></div> </td></tr></table>
gcc

C

compile in C (simple)

gcc -o hello helloworld.c
https://snipt.net/embed/e6cf0fab19d14079dec0f92a2f1048a2/
https://snipt.net/raw/e6cf0fab19d14079dec0f92a2f1048a2/
e6cf0fab19d14079dec0f92a2f1048a2
c
C
1
2016-09-25T08:20:58
True
False
False
/api/public/snipt/24529/
compile-in-c-simple
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="n">gcc</span> <span class="o">-</span><span class="n">o</span> <span class="n">hello</span> <span class="n">helloworld</span><span class="p">.</span><span class="n">c</span> </span></pre></div> </td></tr></table>
"hello world", c, compile, gcc

Text only

GCC Inbuilt variable and search dir path

gcc -v -E -x c++ -dD /dev/null
https://snipt.net/embed/12af66af3a361fa974c8c2887c32092e/
https://snipt.net/raw/12af66af3a361fa974c8c2887c32092e/
12af66af3a361fa974c8c2887c32092e
text
Text only
1
2016-09-22T18:36:34
True
False
False
/api/public/snipt/17058/
gcc-inbuilt-variable-and-search-dir-path
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>gcc -v -E -x c++ -dD /dev/null </span></pre></div> </td></tr></table>
gcc

Bash

create a so library with gcc

$ gcc -fPIC -c myfile.c 
$ gcc -shared -o mylib.so myfile.o 
https://snipt.net/embed/b7512355737e84d121a6bdeb700ddc79/
https://snipt.net/raw/b7512355737e84d121a6bdeb700ddc79/
b7512355737e84d121a6bdeb700ddc79
bash
Bash
3
2016-09-22T18:36:43
True
False
False
/api/public/snipt/6871/
create-a-so-library-with-gcc
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">$ </span>gcc -fPIC -c myfile.c </span><span id="L-2"><a name="L-2"></a><span class="nv">$ </span>gcc -shared -o mylib.so myfile.o </span></pre></div> </td></tr></table>
dll, gcc, linux

Bash

Pass The Date To A GCC #define

-D COMPILE_DATE=\""`date "+%Y-%m-%d %H:%M"`\""
https://snipt.net/embed/3aa05372f92de961c1c9baafb712c55a/
https://snipt.net/raw/3aa05372f92de961c1c9baafb712c55a/
3aa05372f92de961c1c9baafb712c55a
bash
Bash
1
2016-09-25T08:18:38
True
False
False
/api/public/snipt/3470/
pass-the-date-to-a-gcc-define
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>-D <span class="nv">COMPILE_DATE</span><span class="o">=</span><span class="se">\&quot;</span><span class="s2">&quot;`date &quot;</span>+%Y-%m-%d %H:%M<span class="s2">&quot;`\&quot;&quot;</span> </span></pre></div> </td></tr></table>
gcc

Bash

View All Of GCCs Built In #defines

gcc -x c -E -dM /dev/null
https://snipt.net/embed/fc571f629336edd8b8bf8aa0d64b43ab/
https://snipt.net/raw/fc571f629336edd8b8bf8aa0d64b43ab/
fc571f629336edd8b8bf8aa0d64b43ab
bash
Bash
1
2016-09-22T18:36:59
True
False
False
/api/public/snipt/3469/
view-all-of-gccs-built-in-defines
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>gcc -x c -E -dM /dev/null </span></pre></div> </td></tr></table>
gcc

Bash

Ultimate Error Reporting For GCC

1
2
3
4
-Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Winline -Wno-long-long \
-Wconversion -Wstrict-prototypes
https://snipt.net/embed/31659a1f66a2751e9aeb0ca81d2082e6/
https://snipt.net/raw/31659a1f66a2751e9aeb0ca81d2082e6/
31659a1f66a2751e9aeb0ca81d2082e6
bash
Bash
4
2016-09-24T03:24:24
True
False
False
/api/public/snipt/3378/
ultimate-error-reporting-for-gcc
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>-Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align <span class="se">\</span> </span><span id="L-2"><a name="L-2"></a>-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations <span class="se">\</span> </span><span id="L-3"><a name="L-3"></a>-Wredundant-decls -Wnested-externs -Winline -Wno-long-long <span class="se">\</span> </span><span id="L-4"><a name="L-4"></a>-Wconversion -Wstrict-prototypes </span></pre></div> </td></tr></table>
bash, error, gcc
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.