Compilation failiure with FCMD_OBJ_CMD2

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Compilation failiure with FCMD_OBJ_CMD2

Post by uwestoehr »

After commit git commit 4291a087b8cb912a51f9ce03f37cff63b5a40467 I can no longer compile FC:

Code: Select all

2>------ Build started: Project: FreeCADGui, Configuration: Release x64 ------
2>CommandFeat.cpp
2>D:\FreeCAD-git\src\Gui\CommandFeat.cpp(96): error C2059: syntax error: ')'
2>Done building project "FreeCADGui.vcxproj" -- FAILED.
3>------ Build started: Project: SketcherGui, Configuration: Release x64 ------
3>Command.cpp
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\Command.cpp(556): error C2059: syntax error: ')'
3>CommandSketcherTools.cpp
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\CommandSketcherTools.cpp(1968): error C2059: syntax error: ')'
3>D:\FreeCAD-git\src\Mod\Sketcher\Gui\CommandSketcherTools.cpp(2031): error C2059: syntax error: ')'
Werner, can you please have a look since it is your commit?
wmayer wrote: Mon Nov 04, 2019 9:35 pm .
thanks and regards
Uwe
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compilation failiure with FCMD_OBJ_CMD2

Post by wmayer »

Strange, on Linux I didn't get a build failure but the MSVC compiler struggles. So for now I have restored the old definition of the doCommand macro but left copyVisual unchanged.

Actually the old definitions of these macros are not strict ISO C++11 and when building with the -Wpedantic option (which is actually recommended) I get thousands of warnings. The example given in https://en.wikipedia.org/wiki/Variadic_macro#Example is supposed to be ISO compliant but in combination with FCMD_VOBJ_CMD2 the MSVC compiler has problems.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Compilation failiure with FCMD_OBJ_CMD2

Post by uwestoehr »

wmayer wrote: Thu Nov 14, 2019 6:51 pm Strange, on Linux I didn't get a build failure but the MSVC compiler struggles. So for now I have restored the old definition of the doCommand macro but left copyVisual unchanged.
Thanks. Now it compiles again.
I think the design of C leads to situations like this. Ideally a programming language should be designed that way that there is only one way to compile code. But well, at least C++ is ISO-normed ;)
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compilation failiure with FCMD_OBJ_CMD2

Post by wmayer »

But well, at least C++ is ISO-normed
But in this case a compiler extension is used and thus the code is not strict ISO C++ and that's why I used the -Wpedantic option to discover all this non-compliant code locations.
Post Reply