coin3d / coin

Coin3D core library
BSD 3-Clause "New" or "Revised" License
276 stars 106 forks source link

Coin3D fails to build on MacOS X #110

Closed VolkerEnderlein closed 8 years ago

VolkerEnderlein commented 8 years ago

Original report by Daniel Rugerio (Bitbucket: jflash, GitHub: jflash).


The configure script executes without problems, but when I issue the make command, the compiler gives the following errors:

#!
In file included from base/all-base-cpp.cpp:70:
In file included from base/SbVec2ub.cpp:36:
../include/Inventor/SbVec2us.h:70:54: error: expected '(' for function-style cast or type construction
  SbVec2us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); return *this; }
                                            ~~~~~~~~ ^
../include/Inventor/SbVec2us.h:70:91: error: expected '(' for function-style cast or type construction
  SbVec2us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); return *this; }
                                                                                 ~~~~~~~~ ^
../include/Inventor/SbVec2us.h:70:31: warning: unused parameter 'd' [-Wunused-parameter]
  SbVec2us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); return *this; }
                              ^
../include/Inventor/SbVec2us.h:72:100: error: expected '(' for function-style cast or type construction
  SbVec2us & operator /= (int d) { SbDividerChk("SbVec2us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); return *this; }
                                                                                          ~~~~~~~~ ^
../include/Inventor/SbVec2us.h:72:137: error: expected '(' for function-style cast or type construction
  SbVec2us & operator /= (int d) { SbDividerChk("SbVec2us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); return *this; }
                                                                                                                               ~~~~~~~~ ^
In file included from base/all-base-cpp.cpp:78:
In file included from base/SbVec3ub.cpp:36:
../include/Inventor/SbVec3us.h:74:54: error: expected '(' for function-style cast or type construction
  SbVec3us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); return *this; }
                                            ~~~~~~~~ ^
../include/Inventor/SbVec3us.h:74:91: error: expected '(' for function-style cast or type construction
  SbVec3us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); return *this; }
                                                                                 ~~~~~~~~ ^
../include/Inventor/SbVec3us.h:74:128: error: expected '(' for function-style cast or type construction
  SbVec3us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); return *this; }
                                                                                                                      ~~~~~~~~ ^
../include/Inventor/SbVec3us.h:74:31: warning: unused parameter 'd' [-Wunused-parameter]
  SbVec3us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); return *this; }
                              ^
../include/Inventor/SbVec3us.h:76:100: error: expected '(' for function-style cast or type construction
  SbVec3us & operator /= (int d) { SbDividerChk("SbVec3us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); retu...
                                                                                          ~~~~~~~~ ^
../include/Inventor/SbVec3us.h:76:137: error: expected '(' for function-style cast or type construction
  SbVec3us & operator /= (int d) { SbDividerChk("SbVec3us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); retu...
                                                                                                                               ~~~~~~~~ ^
../include/Inventor/SbVec3us.h:76:174: error: expected '(' for function-style cast or type construction
  ...& operator /= (int d) { SbDividerChk("SbVec3us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); return *this; }
                                                                                                                                                              ~~~~~~~~ ^
In file included from base/all-base-cpp.cpp:86:
In file included from base/SbVec4ub.cpp:36:
../include/Inventor/SbVec4us.h:70:54: error: expected '(' for function-style cast or type construction
  SbVec4us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); vec[3] = unsigned short(vec[3] * d); return *this; }
                                            ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:70:91: error: expected '(' for function-style cast or type construction
  SbVec4us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); vec[3] = unsigned short(vec[3] * d); return *this; }
                                                                                 ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:70:128: error: expected '(' for function-style cast or type construction
  SbVec4us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); vec[3] = unsigned short(vec[3] * d); return *this; }
                                                                                                                      ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:70:165: error: expected '(' for function-style cast or type construction
  SbVec4us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); vec[3] = unsigned short(vec[3] * d); return *this; }
                                                                                                                                                           ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:70:31: warning: unused parameter 'd' [-Wunused-parameter]
  SbVec4us & operator *= (int d) { vec[0] = unsigned short(vec[0] * d); vec[1] = unsigned short(vec[1] * d); vec[2] = unsigned short(vec[2] * d); vec[3] = unsigned short(vec[3] * d); return *this; }
                              ^
../include/Inventor/SbVec4us.h:72:100: error: expected '(' for function-style cast or type construction
  SbVec4us & operator /= (int d) { SbDividerChk("SbVec4us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); vec[...
                                                                                          ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:72:137: error: expected '(' for function-style cast or type construction
  SbVec4us & operator /= (int d) { SbDividerChk("SbVec4us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); vec[...
                                                                                                                               ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:72:174: error: expected '(' for function-style cast or type construction
  ...& operator /= (int d) { SbDividerChk("SbVec4us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); vec[3] = unsign...
                                                                                                                                                              ~~~~~~~~ ^
../include/Inventor/SbVec4us.h:72:211: error: expected '(' for function-style cast or type construction
  ...d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); vec[2] = unsigned short(vec[2] / d); vec[3] = unsigned short(vec[3] / d); return *this; }
VolkerEnderlein commented 8 years ago

Original comment by Claude Safon (Bitbucket: claude_safon, ).


Same on Ubuntu 15.10: g++ -DHAVE_CONFIG_H -I../../include -I../../../Coin3D-coin-f5e2bb476519/include -I../../src -I../../../Coin3D-coin-f5e2bb476519/src -D_REENTRANT -DCOIN_DEBUG=1 -DCOIN_INTERNAL -g -O2 -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -fno-builtin -finline-functions -Wreturn-type -Wchar-subscripts -Wparentheses -MT SbVec2ub.lo -MD -MP -MF .deps/SbVec2ub.Tpo -c ../../../Coin3D-coin-f5e2bb476519/src/base/SbVec2ub.cpp -fPIC -DPIC -o .libs/SbVec2ub.o In file included from ../../../Coin3D-coin-f5e2bb476519/src/base/SbVec2ub.cpp:36:0: ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h: In member function ‘SbVec2us& SbVec2us::operator=(int)’: ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h:70:45: error: expected primary-expression before ‘unsigned’ SbVec2us & operator = (int d) { vec[0] = unsigned short(vec[0] d); vec[1] = unsigned short(vec[1] d); return this; } ^ ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h:70:82: error: expected primary-expression before ‘unsigned’ SbVec2us & operator = (int d) { vec[0] = unsigned short(vec[0] d); vec[1] = unsigned short(vec[1] d); return this; } ^ ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h: In member function ‘SbVec2us& SbVec2us::operator/=(int)’: ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h:72:91: error: expected primary-expression before ‘unsigned’ SbVec2us & operator /= (int d) { SbDividerChk("SbVec2us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); return this; } ^ In file included from ../../../Coin3D-coin-f5e2bb476519/src/base/SbVec2ub.cpp:36:0: ../../../Coin3D-coin-f5e2bb476519/include/Inventor/SbVec2us.h:72:128: error: expected primary-expression before ‘unsigned’ SbVec2us & operator /= (int d) { SbDividerChk("SbVec2us::operator/=(int)", d); vec[0] = unsigned short(vec[0] / d); vec[1] = unsigned short(vec[1] / d); return *this; } ^ Makefile:1004: recipe for target 'SbVec2ub.lo' failed

VolkerEnderlein commented 8 years ago

Original comment by Roy Walmsley (Bitbucket: walroy, GitHub: walroy).


When I compile the file SbVec2ub on my WIndows system with Visual Studio 2008 it compiles without error. I don't have Mac or Linux systems I can reproduce on.

I looked at the first couple of errors in Daniel's error log and it looks like it is complaining about the cast. Does it not like 'short' after 'unsigned', or does in not like 'unsigned'?

Would it help, for example, to put the 'unsigned short' in brackets? It still compiles on my system. And your error messages indicate an expectation of a '('. Please can you try it and let me know how you get on?

Roy

VolkerEnderlein commented 8 years ago

Original comment by Ryan Rios (Bitbucket: rrios_eq, ).


I also had issues compiling in OS X earlier this week, but I was able to succeed by enclosing unsigned short in parentheses, for example unsigned short(vec[0] * d) -> (unsigned short)(vec[0] * d). So, I modified these three files:

Now if I could only get SoXt to compile too...

VolkerEnderlein commented 8 years ago

Original comment by Roy Walmsley (Bitbucket: walroy, GitHub: walroy).


Thanks, Ryan. I'll modify those files and commit them.

VolkerEnderlein commented 8 years ago

Original comment by Roy Walmsley (Bitbucket: walroy, GitHub: walroy).


OK. I have updated the files. Please can you confirm that solves your problem.

VolkerEnderlein commented 8 years ago

Original comment by Daniel Rugerio (Bitbucket: jflash, GitHub: jflash).


Hi.

Sorry for taking too long to answer, and thank you very much for your response.

I can confirm that commit solved the problem. However, I can't say if it was for LLVM or GCC, as I have both installed and don't know which one was configured.

VolkerEnderlein commented 8 years ago

Original comment by Ryan Rios (Bitbucket: rrios_eq, ).


In my case it was Coin was configured for LLVM.

VolkerEnderlein commented 8 years ago

Original comment by Roy Walmsley (Bitbucket: walroy, GitHub: walroy).


Thanks guys

VolkerEnderlein commented 8 years ago

Original comment by Roy Walmsley (Bitbucket: walroy, GitHub: walroy).


Resolved by direct fix