C++ Loop: expected primary-expression before ‘;’ token
<p>I have a loop like below, I think the problem is with the inner for loops marked "See here". Whats the problem with that? </p>

<pre><code>// measure time to write different sizes of data
for (int i = 0; i &lt; sizeof(sizes)/sizeof(int); i++) {
    lengthMod = sizes[i]/sizeof(int) - 1;

    start = wall_clock_time();

    for (unsigned int j = 0; j &lt; 10; j++) // &lt;&lt; See here!!!
        tmp = 1;

    // force any write back cache to flush. read from other data source
    for (unsigned int j = 0; j &lt; REPS; j++) // &lt;&lt; Or here!!!
        tmp = j;

    end = wall_clock_time();
    timeTaken = ((float)(end - start))/1000000000;
    fprintf(stderr, "%d, %1.2f \n", sizes[i]/1024, ((float)(end - start))/1000000000);
}
</code></pre>

<p>You can see the <strong><a href="https://github.com/jiewmeng/cs3210-assign1/blob/master/cache-write.cpp" rel="nofollow">full source on GitHub</a></strong> ~line 32</p>

<hr>

<pre><code>g++ -O3 cache-write.cpp -o cache-write -lrt
cache-write.cpp: In function ‘int main()’:
cache-write.cpp:36:27: error: expected primary-expression before ‘;’ token
cache-write.cpp:36:27: error: expected ‘)’ before ‘;’ token
cache-write.cpp:36:29: error: name lookup of ‘j’ changed for ISO ‘for’ scoping [-fpermissive]
cache-write.cpp:36:29: note: (if you use ‘-fpermissive’ G++ will accept your code)
cache-write.cpp:36:32: error: expected ‘;’ before ‘)’ token
cache-write.cpp:44:11: error: ‘data1’ was not declared in this scope
make: *** [cache-write] Error 1
</code></pre>
