Problem with SketchUp SDK in Qt


#1

Is anybody using Qt with the Sketchup SDK?
I tried making a Qt project with the SDK, but I get a syntax error from the following line in slapi.h:

#define SU_INVALID { 0 }

The error messages that are produced:

error: C2059: syntax error : '{'
error: C2143: syntax error : missing ‘;’ before '{'
error: C2143: syntax error : missing ‘;’ before ‘}’

From what I understand the { 0 } is some kind of zero-init, but its not the same as defining something as a plain 0. What do the braces actually do there?

With Visual Studio the library works fine and I can open a model and read its data.

Any help would be appreciated.


#2

Got a sample with some more context?
@bugra - heard of similar issue before?


#3

SkpSdkTest.zip (871.2 KB)

Here’s an example project. It just needs the slapi binaries and headers in the ‘slapi’ folder.


#4

The problem is this line:

m_model = SU_INVALID;

which expands to

m_model = { 0 };

which is not valid C/C++. You can only use SU_INVALID during initialization of the reference. To set it invalid afterwards, use:

SUSetInvalid(m_model);