CUDA compile error on Linux, but Windows Visual Studio succeed
<p>This program can build successfully on Windows - Visual Studio 12, but I got some problem when I compile it on Linux.</p>

<p>Compile command : <code>nvcc main.cu</code></p>

<pre><code>int main(int argc, char **argv) {

    ... (Skip some code)

    // Read file.
    MemoryBuffer&lt;char&gt; text(size + 1); // size type is size_t
    auto text_smem = text.CreateSync(size);
    fread(text_smem.get_cpu_wo(), 1, size, fp);

    ... (Skip some code)

}
</code></pre>

<p>Compiler error message:</p>

<ol>
<li><p><code>auto text_smem = text.CreateSync(size);</code></p>

<p>occured about <strong><code>error: explicit type is missing ("int" assumed)</code></strong> and <strong><code>error: no suitable conversion function from "SyncedMemory&lt;char&gt;" to "int" exists</code></strong></p></li>
<li><p><code>fread(text_smem.get_cpu_wo(), 1, size, fp);</code></p>

<p>occured about <strong><code>error: expression must have class type</code></strong></p></li>
</ol>

<p>How to solve the compiler error in Linux OS?</p>

<hr>

<p>MemoryBuffer is a class, detail code can see from <a href="https://gist.github.com/grass0916/0ac6871137b845348dc6" rel="nofollow">here</a>.</p>