Hello,
I get the following error while compiling the lib on Linux. What should I do>
error: invalid initialization of non-const reference of type ‘nvdb::Vector3DF&’ from an rvalue of type ‘nvdb::Vector3DF’
Mir
Hello,
I get the following error while compiling the lib on Linux. What should I do>
error: invalid initialization of non-const reference of type ‘nvdb::Vector3DF&’ from an rvalue of type ‘nvdb::Vector3DF’
Mir
Hi Mir,
Can you paste the code line where this fails? Which file?
Difficult to help without knowing more context and code details.
Regards,
Rama
I am having the same problem. Here is the relavant code/output…
…/gvdb-voxels/source/gvdb_library/src/gvdb_camera.cpp: In member function ‘void nvdb::Camera3D::setMatrices(const float*, const float*, nvdb::Vector3DF)’:
…/gvdb-voxels/source/gvdb_library/src/gvdb_camera.cpp:510:71: error: invalid initialization of non-const reference of type ‘nvdb::Vector3DF&’ from an rvalue of type ‘nvdb::Vector3DF’
invrot_matrix.InverseView ( view_matrix.GetDataF(), Vector3DF(0,0,0) ); // Computed using rule: "Inverse of a basi
^
In file included from …/gvdb-voxels/source/gvdb_library/src/gvdb_camera.h:22:0,
from …/gvdb-voxels/source/gvdb_library/src/gvdb_camera.cpp:23:
…/gvdb-voxels/source/gvdb_library/src/gvdb_vec.h:438:13: note: initializing argument 2 of ‘nvdb::Matrix4F& nvdb::Matrix4F::InverseView(const float*, nvdb::Vector3DF&)’
Matrix4F &InverseView ( const float* mat, Vector3DF& pos );
^
CMakeFiles/gvdb.dir/build.make:483: recipe for target ‘CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o’ failed
make[2]: *** [CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/gvdb.dir/all’ failed
make[1]: *** [CMakeFiles/gvdb.dir/all] Error 2
Makefile:127: recipe for target ‘all’ failed
make: *** [all] Error 2
I have the exact same error coming up, even at the same line of source code
make
-- -------------------------------
-- Processing Project gvdb:
-- found sub-folder cmake
-- BASE_DIRECTORY = /home/vlab/codes/source/gvdb_library
-- CMAKE_CURRENT_SOURCE_DIR = /home/vlab/codes/source/gvdb_library
-- found Glew source code. Using it instead of library
-- --> Using package CUDA (ver 8.0)
-- --> NOTE: OPENVDB is not enabled. Enable with the USE_OPENVDB option.
-- Located CUDA kernels: kernels/cuda_gvdb_copydata.cu;kernels/cuda_gvdb_module.cu;kernels/cuda_gvdb.cuh;kernels/cuda_gvdb_dda.cuh;kernels/cuda_gvdb_geom.cuh;kernels/cuda_gvdb_nodes.cuh;kernels/cuda_gvdb_operators.cuh;kernels/cuda_gvdb_particles.cuh;kernels/cuda_gvdb_raycast.cuh;kernels/cuda_gvdb_scene.cuh;kernels/cuda_math.cuh
-- Build: /home/vlab/codes/build/gvdb_library
-- Lib: /usr/local/gvdb/lib
-- Inc: /usr/local/gvdb/include
-- Share: /usr/local/gvdb/lib
-- Libraries used:
/usr/lib/x86_64-linux-gnu/libcuda.so
/usr/local/cuda/lib64/libcudart.so
-- Shaders used: /home/vlab/codes/source/gvdb_library/shaders/simple.frag.glsl;/home/vlab/codes/source/gvdb_library/shaders/simple.vert.glsl;/home/vlab/codes/source/gvdb_library/shaders/voxelize.frag.glsl;/home/vlab/codes/source/gvdb_library/shaders/voxelize.geom.glsl;/home/vlab/codes/source/gvdb_library/shaders/voxelize.vert.glsl
-- PTX files: /home/vlab/codes/build/gvdb_library/cuda_gvdb_copydata.ptx;/home/vlab/codes/build/gvdb_library/cuda_gvdb_module.ptx
--
GVDB INSTALL PATH: /usr/local/gvdb
-- GVDB will be installed to this path post-build (win32) or during make install (linux)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vlab/codes/build/gvdb_library
[ 5%] Building CXX object CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o
/home/vlab/codes/source/gvdb_library/src/gvdb_camera.cpp: In member function ‘void nvdb::Camera3D::setMatrices(const float*, const float*, nvdb::Vector3DF)’:
/home/vlab/codes/source/gvdb_library/src/gvdb_camera.cpp:510:71: error: invalid initialization of non-const reference of type ‘nvdb::Vector3DF&’ from an rvalue of type ‘nvdb::Vector3DF’
invrot_matrix.InverseView ( view_matrix.GetDataF(), Vector3DF(0,0,0) ); // Computed using rule: "Inve
^
In file included from /home/vlab/codes/source/gvdb_library/src/gvdb_camera.h:22:0,
from /home/vlab/codes/source/gvdb_library/src/gvdb_camera.cpp:23:
/home/vlab/codes/source/gvdb_library/src/gvdb_vec.h:438:13: note: initializing argument 2 of ‘nvdb::Matrix4F& nvdb::Matrix4F::InverseView(const float*, nvdb::Vector3DF&)’
Matrix4F &InverseView ( const float* mat, Vector3DF& pos );
^
CMakeFiles/gvdb.dir/build.make:371: recipe for target 'CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o' failed
make[2]: *** [CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/gvdb.dir/all' failed
make[1]: *** [CMakeFiles/gvdb.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I think it finds all the libraries it needs, or at least the paths it shows seem ok. But it won’t build. I re-installed all the toolkits that are mentioned in the GVDB-Voxels repo, but it didn’t fix it.
Are there any news about this?
Thanks in advance for any help :)
Hi,
I’m getting the same error as well.
[ 80%] Building CXX object CMakeFiles/gvdb.dir/src/gvdb_camera.cpp.o
/home/xxxx/NVIDIA_GVDB/source/gvdb_library/src/gvdb_camera.cpp: In member function ‘void nvdb::Camera3D::setMatrices(const float*, const float*, nvdb::Vector3DF)’:
/home/xxxx/NVIDIA_GVDB/source/gvdb_library/src/gvdb_camera.cpp:510:71: error: invalid initialization of non-const reference of type ‘nvdb::Vector3DF&’ from an rvalue of type ‘nvdb::Vector3DF’
nvrot_matrix.InverseView ( view_matrix.GetDataF(), Vector3DF(0,0,0) ); // Comp
I changed the following line in source/gvdb_library/src/gvdb_camera.cpp, function “void Camera3D::setMatrices” from:
invrot_matrix.InverseView ( view_matrix.GetDataF(), Vector3DF(0, 0, 0) );
to this:
Vector3DF tvz1(0, 0, 0);
invrot_matrix.InverseView ( view_matrix.GetDataF(), tvz1 );
This works now.
@boltcfd has the correct workaround.
On linux it is not possible to initialize an non-constant argument using a constructor.
In the future these arguments will be made const in the header.