From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Sun Feb 18 2018 - 23:41:17 CST

Hi Sergio,

Did you replace g++ with icc or icpc? Consider the following test code:

#include <cstdio>
int main (int argc, char **argv) {
        int i;
        for (int i = 0; i <10 ; i++) {
                printf("%d\n", i);
        }
}

gcc will refuse to compile it, since “i” is redefined, and that doesn’t comply with the old c standards. g++ will compile it just fine. icpc will compile it just fine too. icc, however, will also complain about i being redefined again, since again, it is using the c standards. The moral of the story is that your correct or incorrect installation of the OSPRayRenderer is a red herring. The real problem is likely your makefile adjustments to switch from the gnu to intel compiler toolchain, and accidentally compiling with a C compiler rather than a C++ compiler.

Josh Vermaas

Director’s Postdoctoral Fellow
National Renewable Energy Laboratory
joshua.vermaas_at_nrel.gov<mailto:joshua.vermaas_at_nrel.gov>

On Feb 18, 2018, at 1:10 PM, sperez14_at_us.es<mailto:sperez14_at_us.es> wrote:

Dear vmd comunity,

When I try to compile vmd from the source I get this error:

Compiling OSPRayRenderer.C --> OSPRayRenderer.o ...
OSPRayRenderer.C: In member function ‘void OSPRayRenderer::render_compile_and_validate()’:
OSPRayRenderer.C:662:12: error: redeclaration of ‘int i’
  for (int i = 0; i < directional_lights.num(); ++i) {
           ^
OSPRayRenderer.C:552:7: error: ‘int i’ previously declared here
  int i;
      ^
OSPRayRenderer.C: In member function ‘void OSPRayRenderer::cylinder_array(Matrix4*, float, float*, int, float*, int)’:
OSPRayRenderer.C:2027:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i=0,ind4=0,ind6=0,ind7=0; i<cylnum; i++,ind4+=4,ind6+=6,ind7+=7) {
                                     ^
OSPRayRenderer.C:2035:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i=0,ind4=0,ind6=0,ind7=0; i<cylnum; i++,ind4+=4,ind6+=6,ind7+=7) {
                                     ^
OSPRayRenderer.C: In member function ‘void OSPRayRenderer::trimesh_c4u_n3f_v3f(Matrix4&, unsigned char*, float*, float*, int,
int)’:
OSPRayRenderer.C:2474:11: warning: unused variable ‘norm’ [-Wunused-variable]
    float norm[9];
          ^
OSPRayRenderer.C:2472:15: warning: unused variable ‘cn2f’ [-Wunused-variable]
  const float cn2f = 1.0f / 127.5f;
              ^
OSPRayRenderer.C: In member function ‘void OSPRayRenderer::trimesh_n3f_v3f(Matrix4&, float*, float*, float*, int, int)’:
OSPRayRenderer.C:2630:14: warning: unused variable ‘c’ [-Wunused-variable]
  const rgba c = { uniform_color[0],
             ^
Makefile:578: recipe for target 'OSPRayRenderer.o' failed
make: *** [OSPRayRenderer.o] Error 1

I think I have installed OSPRay correctly (v1.1.1) I do not understand why it fails. My configure options are:

LINUXAMD64 OPENGL OPENGLPBUFFER FLTK TK ACTC IMD LIBSBALL XINERAMA XINPUT LIBOPTIX LIBOSPRAY LIBTACHYON VRPN NETCDF COLVARS TCL PYTHON PTHREADS NUMPY SILENT GCC

The same as linux.amd64.opengl but chaning GCC to ICC.

Thank you very much for your help,

Sergio