jcward / hxtelemetry

Haxe Telemetry Generator for hxScout
MIT License
61 stars 12 forks source link

'void' function returning a value #45

Closed thegoodideaco closed 8 years ago

thegoodideaco commented 8 years ago

I'm getting an unusual error:

./src/hxtelemetry/CppHxTelemetry.cpp(140) : error C2562: 'hxtelemetry::CppHxTelemetry_obj::dump_telemetry_frame' : 'void' function returning a value

this is running on: hxcpp-debugger: git [dev:C:\HaxeToolkit\haxe\lib\hxcpp-debugger/git] hxcpp: 3.2.205 [3.3.49] git hxtelemetry: [0.3.3] lime: 2.9.0 [2.9.1] 3.0.3 openfl: 3.6.0 [3.6.1]

jcward commented 8 years ago

Huh, I feel like I've seen that before... I believe it's in reference to this code: https://github.com/jcward/hxtelemetry/blob/master/hxtelemetry/CppHxTelemetry.hx#L82-L188

But the only return statement in that block is return; -- it doesn't appear to be returning a value. Maybe look in your output folder at: ./src/hxtelemetry/CppHxTelemetry.cpp around line 140 and see what's there -- a return statement returning something? Maybe it's an older version of hxtelemetry?

mastef commented 8 years ago

Works by using the git version of hxtelemetry, the haxelib version throws that error

jcward commented 8 years ago

Ah, @mastef - thanks for the note! I'll try to push up the latest to haxelib today.

jcward commented 8 years ago

Ok, I've pushed the latest to haxelib. I'm going to close this issue. Feel fee to comment / reopen if it's still a problem.

bendmorris commented 8 years ago

On 0.3.4 I'm getting what seems to be the opposite of this error:

./src/hxtelemetry/CppHxTelemetry.cpp:240:33: error: non-void function 'dump_telemetry_frame' should return a value [-Wreturn-type]
if (frame==0 || output==null()) return;

After downgrading to 0.3.3 this error disappeared.

jcward commented 7 years ago

Weird, there seem to be cases where it wants a return null(); and cases where it wants a return; at this line.

I've just replaced it with an if clause (no return statement at all.) Hopefully fixes everyone. Pushed 0.3.5 to haxelib.

madrazo commented 7 years ago

Hehe, I got with Haxe 3.4.2, hxcpp git

Error: CppHxTelemetry.cpp
./src/hxtelemetry/CppHxTelemetry.cpp(134): error C2562: 'hxtelemetry::CppHxTelemetry_obj::dump_telemetry_frame': 'void' function returning a value
./src/hxtelemetry/CppHxTelemetry.cpp(121): note: see declaration of 'hxtelemetry::CppHxTelemetry_obj::dump_telemetry_frame'

code in CppHxTelemetry.cpp(134) is

if (frame==0 || output==null()) return null();

Edit: reinstalling hxtelemetry solved it!

jcward commented 7 years ago

@madrazo

Edit: reinstalling hxtelemetry solved it!

Phew! I was about to lose my mind with this bug. :grin: