compile issue with wingw gcc versus MS VirtualStudio 2015 basic
Hey,
I have sources with a makefile. I have used cmake to make a MS VirtualStudio project and to make a mingw project and codeblocks mingw project. With MS VirtualStudio the project compiles without any problem. With mingw32-make I have following compilation problem: error: lvalue required as left operand of assignment. I’m starting to learn C++ and can’t figure this out. This are the two lines with the error:
I have included the functions were the errors appear and marked the lines in bold. Anyone an idea why this compiles in MS VS and not with mingw32-make.
Thanks
serial_windows.c:237:21: error: lvalue required as left operand of assignment
Left of the assignment operator, you cast your type to a handle using the C-style cast operator. After casting, you get an rvalue. And rvalues may not be assigned to (which is quite understandable, since rvalues are actually values like constants and other non-variable values). Mingw detected this and gives you an error (as it should). Apparently the MS Visual C++ compiler doesn't know that casting gives you an rvalue, or it just didn't check the statements.