Can't compile my project after last update

Hi there!
Something wrong with SWF after last update with cpp target.

I’m loading SWF via byte array:
var swf:SWF = new SWF(Assets.getBytes(“lib.swf”));

Here is an error :smile:

D:\PROJECTS\Helicopter\Gama\Export\windows\cpp\obj\include\format/swf/events/SWF
WarningEvent.h(44) : error C2059: syntax error : 'constant'
D:\PROJECTS\Helicopter\Gama\Export\windows\cpp\obj\include\format/swf/events/SWF
WarningEvent.h(44) : error C2238: unexpected token(s) preceding ';'
D:\PROJECTS\Helicopter\Gama\Export\windows\cpp\obj\include\format/swf/events/SWF
WarningEvent.h(45) : error C2059: syntax error : 'constant'
D:\PROJECTS\Helicopter\Gama\Export\windows\cpp\obj\include\format/swf/events/SWF
WarningEvent.h(45) : error C2238: unexpected token(s) preceding ';'
./src/format/swf/events/SWFWarningEvent.cpp(71) : error C2589: 'constant' : ille
gal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(71) : error C2143: syntax error : mi
ssing ';' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(71) : error C2059: syntax error : ':
:'
./src/format/swf/events/SWFWarningEvent.cpp(73) : error C2589: 'constant' : ille
gal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(73) : error C2143: syntax error : mi
ssing ';' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(73) : error C2059: syntax error : ':
:'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2589: 'constant' : ill
egal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2143: syntax error : m
issing ')' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2780: 'void hx::MarkMe
mber(Array<T> &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(20) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2780: 'void hx::MarkMe
mber(hx::ObjectPtr<T> &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(12) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2780: 'void hx::MarkMe
mber(T &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(10) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(153) : error C2059: syntax error : '
)'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2589: 'constant' : ill
egal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2143: syntax error : m
issing ')' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2780: 'void hx::MarkMe
mber(Array<T> &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(20) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2780: 'void hx::MarkMe
mber(hx::ObjectPtr<T> &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(12) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2780: 'void hx::MarkMe
mber(T &,hx::MarkContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(10) : see
declaration of 'hx::MarkMember'
./src/format/swf/events/SWFWarningEvent.cpp(154) : error C2059: syntax error : '
)'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2589: 'constant' : ill
egal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2143: syntax error : m
issing ')' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2780: 'void hx::VisitM
ember(Array<T> &,hx::VisitContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(54) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2780: 'void hx::VisitM
ember(hx::ObjectPtr<T> &,hx::VisitContext *)' : expects 2 arguments - 0 provided

        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(42) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2780: 'void hx::VisitM
ember(T &,hx::VisitContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(40) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(160) : error C2059: syntax error : '
)'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2589: 'constant' : ill
egal token on right side of '::'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2143: syntax error : m
issing ')' before '::'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2780: 'void hx::VisitM
ember(Array<T> &,hx::VisitContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(54) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2780: 'void hx::VisitM
ember(hx::ObjectPtr<T> &,hx::VisitContext *)' : expects 2 arguments - 0 provided

        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(42) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2780: 'void hx::VisitM
ember(T &,hx::VisitContext *)' : expects 2 arguments - 0 provided
        C:\HaxeToolkit\haxe\lib\hxcpp\3,1,48\include\hx/GCTemplates.h(40) : see
declaration of 'hx::VisitMember'
./src/format/swf/events/SWFWarningEvent.cpp(161) : error C2059: syntax error : '
)'
./src/format/swf/events/SWFWarningEvent.cpp(184) : error C2440: '=' : cannot con
vert from 'String' to 'int'
        No user-defined-conversion operator available that can perform this conv
ersion, or the operator cannot be called
./src/format/swf/events/SWFWarningEvent.cpp(185) : error C2440: '=' : cannot con
vert from 'String' to 'int'
        No user-defined-conversion operator available that can perform this conv
ersion, or the operator cannot be called
Error: error running cl.exe -Iinclude -nologo -Od -DHX_WINDOWS -GR -Zi -Fdobj/ms
cv16-debug-ncxp/vc.pdb -Oy- -c -EHs -GS- -arch:SSE -IC:/HaxeToolkit/haxe/lib/hxc
pp/3,1,48/include -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=311 -D_CR
T_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MI
SMATCH -DHX_WIN_MAIN -wd4996 -MT ./src/format/swf/events/SWFWarningEvent.cpp -Fo
obj/mscv16-debug-ncxp/807cbbf3_SWFWarningEvent.obj

When I tried to compile to flash target, I got:

C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFButtonCondAction.hx:47: cha
racters 24-31 : Array<format.swf.data.actions.IAction> should be flash.Vector<fo
rmat.swf.data.actions.IAction>
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFButtonCondAction.hx:47: cha
racters 24-31 : For function argument 'actions'
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFClipActionRecord.hx:36: cha
racters 24-31 : Array<format.swf.data.actions.IAction> should be flash.Vector<fo
rmat.swf.data.actions.IAction>
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFClipActionRecord.hx:36: cha
racters 24-31 : For function argument 'actions'

Neko works fine.

Installed libs:
format: [3.1.2]
haxeui: 1.6.10 1.6.12 1.6.15 1.6.16 [1.6.17]
hscript: [2.0.4]
hxcpp: 3.1.39 [3.1.48]
hxcs: [3.1.1]
hxsl: [2.0.5]
lime: 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 [2.0.5]
mtwin: [1.6.0]
nape: [2.0.16]
nme: 5.1.8 [5.2.7]
openfl-bitfive: [2.1.6]
openfl-html5: [1.4.2-beta]
openfl-samples: 2.1.0 2.2.0 [2.2.1]
openfl: 2.1.6 2.1.7 2.1.8 2.2.0 2.2.1 2.2.2 [2.2.3]
spritesheet: [1.2.0]
stablexui: [1.1.4]
svg: [1.0.8]
swf: 1.6.9 1.7.0 1.7.2 1.7.3 [1.7.4]
systools: [1.1.0]
waxe: [3.1.1]
yagp: [1.1.4]

Any help? :smile:

Do you know a test I could use to reproduce it? Does it occur with “SimpleSWFLayout” or “NyanCat” from the samples? What targets did you try?

Got it :smile:


You only need the SWF fix, the HXCPP fix will help resolve this problem in the future.

I’ll try and release SWF again soon with the patch :smile:

Released, please try haxelib update swf to get the newest version

1 Like

Thank you, Joshua! :wink:
Cpp target works fine now,
but flash target still have some issues:

C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFButtonCondAction.hx:47: cha
racters 24-31 : Array<format.swf.data.actions.IAction> should be flash.Vector<fo
rmat.swf.data.actions.IAction>
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFButtonCondAction.hx:47: cha
racters 24-31 : For function argument 'actions'
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFClipActionRecord.hx:36: cha
racters 24-31 : Array<format.swf.data.actions.IAction> should be flash.Vector<fo
rmat.swf.data.actions.IAction>
C:/HaxeToolkit/haxe/lib/swf/1,7,4/format/swf/data/SWFClipActionRecord.hx:36: cha
racters 24-31 : For function argument 'actions'

If you need to reproduce it, here is the code inside empty project:

var swf:SWF = new SWF(Assets.getBytes("lib.swf"));
var clip:Sprite = cast swf.createMovieClip("Symbol1");
this.addChild(clip);

This should be fixed now, though I would not recommend this pattern on Flash.

If you use Assets.loadLibrary with SWF (or enable "preload" in order to be able to skip directly to Assets.getMovieClip()) then it uses the standard Flash mechanism for decoding SWF content, rather than doing it all manually. Particularly for images (which must be unpremultiplied to render properly otherwise) there’s a huge performance difference, since Flash Player doesn’t otherwise provide accelerated decoding, like we can do on other platforms

1 Like

Thanks for advice! :wink: