Closed ComradeMashkov closed 3 months ago
I suspect this is a copy-and-paste error. Try removing the (int) cast and see if it builds OK. Please report back :)
Yes, I already did this trick and removed (int) cast. However, now I'm getting endless lines of linking errors like these:
I suspect this is a copy-and-paste error. Try removing the (int) cast and see if it builds OK. Please report back :)
Can this be fixed by any chance?
Duplicate of #2518
osgEarth Version (required): master cdaabe2
Error: invalid conversion
Error log
``` C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp: In function 'bool osgEarth::Serializers::CompressedVec3Array::readData(osgDB::InputStream&, osgEarth::CompressedVec3Array&)': C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:51: error: no match for 'operator>>' (operand types are 'osgDB::InputStream' and 'int') 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~ | | | | osgDB::InputStream int In file included from C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:6: C:/msys64/mingw64/include/osgDB/InputStream:104:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(osgDB::ObjectProperty&)' (near match) 104 | InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:104:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: invalid user-defined conversion from 'int' to 'osgDB::ObjectProperty&' [-fpermissive] 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ In file included from C:/msys64/mingw64/include/osgDB/StreamOperator:8, from C:/msys64/mingw64/include/osgDB/InputStream:35: C:/msys64/mingw64/include/osgDB/DataTypes:109:5: note: candidate is: 'osgDB::ObjectProperty::ObjectProperty(const char*, int, bool)' (near match) 109 | ObjectProperty( const char* name, int value=0, bool useMap=false ) | ^~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/DataTypes:109:5: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ | | | int C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ | | | int C:/msys64/mingw64/include/osgDB/DataTypes:109:33: note: initializing argument 1 of 'osgDB::ObjectProperty::ObjectProperty(const char*, int, bool)' 109 | ObjectProperty( const char* name, int value=0, bool useMap=false ) | ~~~~~~~~~~~~^~~~ C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: conversion to non-const reference type 'class osgDB::ObjectProperty&' from rvalue of type 'osgDB::ObjectProperty' [-fpermissive] 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:103:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(osgDB::ObjectGLenum&)' (near match) 103 | InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:103:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'osgDB::ObjectGLenum&' to an rvalue of type 'osgDB::ObjectGLenum' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/DataTypes:95:5: note: after user-defined conversion: 'osgDB::ObjectGLenum::ObjectGLenum(GLenum)' 95 | ObjectGLenum( GLenum value=0 ) : _value(value) {} | ^~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:98:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(double&)' (near match) 98 | InputStream& operator>>( double& d ) { _in->readDouble(d); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:98:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:97:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(float&)' (near match) 97 | InputStream& operator>>( float& f ) { _in->readFloat(f); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:97:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:96:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(long unsigned int&)' (near match) 96 | InputStream& operator>>( unsigned long& l ) { _in->readULong(l); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:96:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:95:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(long int&)' (near match) 95 | InputStream& operator>>( long& l ) { _in->readLong(l); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:95:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:94:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(unsigned int&)' (near match) 94 | InputStream& operator>>( unsigned int& i ) { _in->readUInt(i); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:94:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:93:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(int&)' (near match) 93 | InputStream& operator>>( int& i ) { _in->readInt(i); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:93:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:92:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(short unsigned int&)' (near match) 92 | InputStream& operator>>( unsigned short& s ) { _in->readUShort(s); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:92:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:91:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(short int&)' (near match) 91 | InputStream& operator>>( short& s ) { _in->readShort(s); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:91:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:90:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(unsigned char&)' (near match) 90 | InputStream& operator>>( unsigned char& c ) { _in->readUChar(c); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:90:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'unsigned char&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:89:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(signed char&)' (near match) 89 | InputStream& operator>>( signed char& c ) { _in->readSChar(c); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:89:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'signed char&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:88:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(char&)' (near match) 88 | InputStream& operator>>( char& c ) { _in->readChar(c); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:88:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'char&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:87:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(bool&)' (near match) 87 | InputStream& operator>>( bool& b ) { _in->readBool(b); checkStream(); return *this; } | ^~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:87:18: note: conversion of argument 1 would be ill-formed: C:\Users\ilya.mashkov\Desktop\gui_cpp\osgearth\src\osgEarth\CompressedArray.cpp:135:54: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int' 135 | is >> is.PROPERTY("Quantization") >> (int)quantization; | ^~~~~~~~~~~~~~~~~ C:/msys64/mingw64/include/osgDB/InputStream:142:18: note: candidate: 'osgDB::InputStream& osgDB::InputStream::operator>>(osg::ref_ptrI don't know am I building osgEarth right way but now I have this error. Is it problem in my compiler or build toolchain? I guess GCC consider this conversion invalid. Btw, are there any guides for building osgEarth from source with MinGW?
Build toolchain: mingw64 (MinGW Makefiles)