Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does compiling with <iostream> cause a 500 error on Apache?
    primarykey
    data
    text
    <p>I'm experimenting with cgi programming in C++ using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) and I've encountered a strange error when I try to run it on my commercial apache server.</p> <p>Apache will run this once it's compiled:</p> <pre><code>#include &lt;cstdio&gt; // no &lt;iostream&gt; int main(int c, char **argv) { printf("Content-Type: text/html; charset=ISO-8859-1\n\n"); printf("Hello printf\n\n"); return 0; } </code></pre> <p>However, the server gives back a 500 error if <strong>iostream</strong> gets included</p> <pre><code>#include &lt;cstdio&gt; #include &lt;iostream&gt; //this will cause a 500 error int main(int c, char **argv) { printf("Content-Type: text/html; charset=ISO-8859-1\n\n"); printf("Hello printf\n\n"); return 0; } </code></pre> <p>If I compile that second program with iostream, the program will run perfectly from the command line, but if I upload the code, apache starts kicking back 500 Errors.</p> <p>Just for the sake of completeness, I compiled similar programs in both C and Free Pascal as well as C++ using just cstdio. No problems...</p> <p>The problem only arises when I include iostream.</p> <p><em>Note: I didn't forget to change the permissions.</em></p> <p><em>Note: I included "Content-Type: text/html; charset=ISO-8859-1\n\n"</em></p> <p>It's like my server just won't accept something compiled with iostream.</p> <p>Why might <strong>iostream</strong> cause this error when <strong>cstdio</strong> does not and how do I fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload