<div dir="ltr"><div><div><div><div>Hi Chiranjib,<br><br></div>It could be one of several things.  First I would run make VERBOSE=1 to see if the -std=c++0x is getting into the compile command correctly.  If it is, then I would check if your compiler supports that feature.  Especially when using the older compiler versions (the ones that use c++0x rather than c++11) some language features may not be supported.<br><br></div>HTH,<br></div>Shawn<br><br></div>Also, adding the C++11 flags directly in the CMakeLists is not really the recommended way to tell CMake to use C++11.  See these links (help pages for the CMake variables you probably want) for the recommended way to do it [1][2].<br><br>[1]: <a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD.html">https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD.html</a><br>[2]: <a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD_REQUIRED.html">https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD_REQUIRED.html</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 3, 2016 at 6:00 AM, Chiranjib Sur <span dir="ltr"><<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>In my C++ code I am initialising my data members in the header file (example below)</div><div><br></div><div><font face="monospace, monospace" color="#0000ff">class foo{</font></div><div><font face="monospace, monospace" color="#0000ff">public:</font></div><div><font face="monospace, monospace" color="#0000ff"> int myInt =0;</font></div><div><font face="monospace, monospace" color="#0000ff">....</font></div><div><font face="monospace, monospace" color="#0000ff">}</font></div><div><br></div><div>When I create the Makefile using cmake, and try to compile the compiler trows an error that </div><div><br></div><div> <font face="monospace, monospace" color="#0000ff">error: ISO C++ forbids initialization of member ?myInt?<br></font></div><div><br></div><div>I am using the "<font face="monospace, monospace" color="#0000ff">-std=c++0x</font>" flag in my <font color="#0000ff">CMakeLists.txt</font> file.</div><div><br></div><div>This is a standard feature and I am puzzled why the compiler is complaining with the CMake generate Makefile.</div><div><br></div><div>Any expert comments?</div><div><br></div>Thanks,<br>Chiranjib</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>