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

Linking fails for Flax structs in c++ #2245

Closed
z1dev opened this issue Feb 14, 2024 · 2 comments
Closed

Linking fails for Flax structs in c++ #2245

z1dev opened this issue Feb 14, 2024 · 2 comments
Labels
bug Something isn't working scripting
Milestone

Comments

@z1dev
Copy link
Contributor

z1dev commented Feb 14, 2024

Issue description:

I was trying to use TextRange and FontLineCache in Span<> array in a c++ plugin and this resulted in a linker error.

6>Fudgets.Bindings.Gen.obj : error LNK2001: unresolved external symbol "public: static struct ScriptingTypeInitializer TextRange::TypeInitializer" (?TypeInitializer@TextRange@@2UScriptingTypeInitializer@@A) 6>g:\projects\Flax\UIPluginTest\Plugins\Fudgets\Binaries\FudgetsEditorTarget\Windows\x64\Debug\Fudgets.dll : fatal error LNK1120: 1 unresolved externals

Adding the Render2D module to the .Build file(s) in my project didn't help. These structs don't have the FLAXENGINE_API in the engine source, so I added them. Doing that fixes the issue, but I don't know if that's the right solution.

Steps to reproduce:

Make some custom struct in a c++ project, and add for example API_FIELD() Span<TextRange> LineCache; and it will result in link error.

Minimal reproduction project:

Flax version:

1.7 latest master

@z1dev
Copy link
Contributor Author

z1dev commented Feb 14, 2024

There are many other structs in Font.h without the FLAXENGINE_API too.

@mafiesto4 mafiesto4 added bug Something isn't working scripting labels Feb 19, 2024
@mafiesto4 mafiesto4 added this to the 1.8 milestone Feb 19, 2024
@mafiesto4
Copy link
Member

Fixed in 5cada42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scripting
Projects
None yet
Development

No branches or pull requests

2 participants