| Issue 90: | Creating shortcut variable for class fails to be compiled | |
| 1 person starred this issue and may be notified of changes. | Back to list |
class Main
{
static public function main()
{
var M = Math;
trace(M.sin(0));
}
}
The above technique is used by physaxe. It fails to be compiled using haxe r3637, hxcpp r283, VS2010.
The error:
D:\workspace\TestHaxeCpp>haxe compile.hxml
haxelib run hxcpp Build.xml haxe -Dcpp -Dhaxe_206 -Dtrue
Using cl version: 16
BuildTool.hx:154: Creating hxcpp.pch.
cl.exe -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -ID:\repo\hxcpp//
include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Ychxcpp.h __pch.cpp /Fphxcpp.pch
__pch.cpp
cl.exe -I. -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -ID:\repo\hxc
pp//include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Yuhxcpp.h ./src/Main.cpp -Foobj/
Release/src/Main.obj
cl.exe -I. -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -ID:\repo\hxc
pp//include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Yuhxcpp.h ./src/__boot__.cpp -Fo
obj/Release/src/__boot__.obj
__boot__.cpp
Main.cpp
cl.exe -I. -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -ID:\repo\hxc
pp//include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Yuhxcpp.h ./src/__resources__.cp
p -Foobj/Release/src/__resources__.obj
./src/Main.cpp(38) : error C2039: 'sin' : is not a member of 'Class_obj'
d:\repo\hxcpp\include\Class.h(50) : see declaration of 'Class_obj'
Called from ? line 1
Called from BuildTool.hx line 1123
Called from BuildTool.hx line 509
Called from BuildTool.hx line 538
Called from BuildTool.hx line 652
Called from BuildTool.hx line 724
Uncaught exception - Error in building thread
Error : Build failed
Jan 19, 2011
Project Member
#1
gameh...@gmail.com
Jan 20, 2011
I've just reported it as an issue to physaxe. :)
Jan 20, 2011
It should compile in C++ since it is valid haXe code, and it's still a good optimization for flash9+ since the access to the static class is expensive. Using sin = Math.sin won't help since it will create a closure, slowing things down. I'll #if the optimization so it doesn't slowdown in C++
Jan 20, 2011
It should compile now. Still worth to the conditional compile for cpp because the Math functions are automatically inlined.
Status:
Fixed
|