Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include\openfl/events/ErrorEvent.h error #2647

Closed
FuroYT opened this issue Jun 25, 2023 · 13 comments
Closed

include\openfl/events/ErrorEvent.h error #2647

FuroYT opened this issue Jun 25, 2023 · 13 comments

Comments

@FuroYT
Copy link

FuroYT commented Jun 25, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Run 'lime test windows' in the cmd
  2. Wait...
  3. See error

Expected behavior
Finishes building and opening game

Screenshots
image

OpenFL Targets
Windows

Additional context
The building works on debug mode but not the release mode

@B-Interactive
Copy link
Contributor

B-Interactive commented Jun 25, 2023

Hi @FuroYT . When sharing a block of text, you might consider inserting it in your post as text, and not a screenshot. That way it can be indexed by search, and elements copied by people trying to assist. Your error is in French, but I can't copy/paste it into translate, for example.

Anyway, translated:

- src/animateatlas/AtlasFrameMaker.cpp
- src/Song.cpp
- src/openfl/media/Video.cpp [haxe,release]
- src/lime/graphics/opengl/ext/NV_fbo_color_attachments.cpp
- src/Main.cpp
- src/fliexl/ui/FlxTypeButton.cpp
- src/openfl/display/GraphicsShader.cpp [haxe,release]
Error: Main.cpp
include\openfl/events/ErrorEvent.h(50): error C2059: syntax error : 'constant'
include\openfl/events/ErrorEvent.h(50): error C2238: unexpected tokens before ';'

@FuroYT
Copy link
Author

FuroYT commented Jun 25, 2023

Sorry about that and by the way my version of openfl is the latest version

@B-Interactive
Copy link
Contributor

I could be mistaken of course, but that error to me looks like a syntax error in your Main class file. Do you get a more useful error if you target Neko?

lime test neko

@FuroYT
Copy link
Author

FuroYT commented Jun 26, 2023

i just gives me this error and dont even compile

C:/HaxeToolkit/haxe/lib/discord_rpc/git/discord_rpc/DiscordRpc.hx:4: characters 8-20 : You cannot access the cpp package while targeting neko (for cpp.Function)
source/Discord.hx:5: characters 8-30 : ... referenced here
source/Main.hx:20: characters 8-15 : ... referenced here
export/release/neko/haxe/ApplicationMain.hx:319: characters 48-52 : ... referenced here

@Dimensionscape
Copy link
Member

As the error says, you are trying to access cpp packages while compiling for neko...

@FuroYT
Copy link
Author

FuroYT commented Jun 26, 2023

I know I'm not that dumb

@varadig
Copy link

varadig commented Jun 26, 2023

I know I'm not that dumb

Then why don't you temporarily remove the cpp package references from your code to see what happens?

@FuroYT
Copy link
Author

FuroYT commented Jun 26, 2023

I just don't want to break the library and I forgor what's the git url for it

@Dimensionscape
Copy link
Member

You can't compile code using a cpp package for Neko. You will need to target cpp.

Other than that, your issue report is lacking significant information to determine if there is an issue with OpenFL at all in regards to whatever you are trying to accomplish. I'm closing the issue but if you want to properly identify a specific bug or bad behavior in OpenFL, we can reopen it.

Please refrain from issue reporting in order to debug your own code or a third party library. Instead, try seeking help on the forums, discord, or other proper channels.

@FuroYT
Copy link
Author

FuroYT commented Jul 2, 2023

After Debugging A Lot I Saw That The Error Was Caused By My Crash Handler

I Try To Catch Any UncaughtErrorEvent.UNCAUGHT_ERROR Events And Send Them To My Function "onCrash" Which Looks Like This

function onCrash(e:UncaughtErrorEvent):Void
	{
		var errMsg:String = "";
		var path:String;
		var callStack:Array<StackItem> = CallStack.exceptionStack(true);
		var dateNow:String = Date.now().toString();

		dateNow = dateNow.replace(" ", "_");
		dateNow = dateNow.replace(":", "'");

		path = "./crash/" + "Crash" + dateNow + ".txt";

		for (stackItem in callStack)
		{
			switch (stackItem)
			{
				case FilePos(s, file, line, column):
					errMsg += file + " (line " + line + ")\n";
				default:
					Sys.println(stackItem);
			}
		}

		errMsg += "\nUncaught Error: " + e.error;

		if (!FileSystem.exists("./crash/")) FileSystem.createDirectory("./crash/");

		File.saveContent(path, errMsg + "\n");

		Sys.println(errMsg);
		Sys.println("Crash dump saved in " + Path.normalize(path));

		Application.current.window.alert(errMsg, "Error!");
		DiscordClient.shutdown();
		Sys.exit(1);
	}

And To Add The Event Listener I Used

Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash);

But Removing It Breaks The Game

@FuroYT
Copy link
Author

FuroYT commented Jul 2, 2023

and these are all the import used

import openfl.events.UncaughtErrorEvent;
import haxe.CallStack;
import haxe.io.Path;
import Discord.DiscordClient;
import sys.FileSystem;
import sys.io.File;
import sys.io.Process;

@Dimensionscape
Copy link
Member

This is not the proper venue to seek help in debugging your project.

@B-Interactive
Copy link
Contributor

B-Interactive commented Jul 2, 2023

The OpenFL community forum: community.openfl.org/
The OpenFL Discord: discord.gg/tDgq8EE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants