Note that there are some explanatory texts on larger screens.

plurals
  1. POmingwCC compile error (Eclipse Juno)
    text
    copied!<p>Okay, so I am trying to compile something right now and I am new to C++ so maybe the code itself is causing the error however no red marks show up in the code itself that Eclipse is showing me.</p> <p>Here is what the error says </p> <blockquote> <p>c:\mingw\bin../lib/gcc/mingw32/4.6.2/include/c++/bits/move.h:128:7: error: assignment of read-only reference '__a'</p> <p>c:\mingw\bin../lib/gcc/mingw32/4.6.2/include/c++/bits/move.h:129:7: error: assignment of read-only reference '__b'</p> </blockquote> <p>Any ideas on what I need to do? on a Win7, using Eclipse Juno for C++ with MingwCC</p> <p>Here is what I am compiling, the only new thing I added was this "swap" thing that someone told me to use for my permutation program.</p> <p>UPDATED Permutation.cc</p> <pre><code> #include &lt;iostream&gt; // for cout #include &lt;cstdio&gt; // for printf() #include &lt;sstream&gt; // for stringstream #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include "Permutation.h" using namespace std; Permutation::Permutation() { /* nothing needed in the constructor */ } void Permutation::permute(string str) { int low = 0; int high = str.length(); int j; if (low == high) { cout &lt;&lt; str &lt;&lt; endl; } else { for (j = low; j &lt;= high; j++) { std::swap(str[low], str[j]); permute(str, low + 1, high); std::swap(str[low], str[j]); } } } void Permutation::permute(string str, int low, int high) { // int j; // if (low == high) { // cout &lt;&lt; str &lt;&lt; endl; // } else { // for (j = low; j &lt;= high; j++) { // std::swap(str[j + low], str[j + j]); // permute(str, low + 1, high); // std::swap(str[j + low], str[j + j]); // } // } } </code></pre> <p>Permutation.h</p> <pre><code>#pragma once #include &lt;string&gt; using namespace std; class Permutation { public: Permutation(); void permute (string); void permute (string, int, int); private: /* attemp to solve this problem without adding * any instance variables/data members, but * you may add private helper function members * as many as you need */ }; </code></pre> <p>main.cc</p> <pre><code>#include "Permutation.h" int main() { Permutation p; p.permute ("Permute"); p.permute ("--*--", 2, 3); } </code></pre>
 

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