godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Can't open dynamic library

Open MYTNB opened this issue 6 months ago • 2 comments

Godot version

master

godot-cpp version

master

System information

windows10

Issue description

When I compiled the DLL using a multi-layer folder structure, an error occurred: ERROR: Can't open dynamic library: E:/GDProject/project/bin/libgdgamecore.windows.template_debug.x86_64.dll. Error: Error 5: 拒绝访问。. ERROR: Can't open GDExtension dynamic library: 'res://Bin/gamecore.gdextension'.

my sconstruct file wirte:

env.Append(CPPPATH=["cplugin/"]) sources = Glob("cplugin/Frameworks/.cpp") + Glob("cplugin/Frameworks/Objects/.cpp") + Glob("cplugin/*.cpp")

if i only use the : sources = Glob("cplugin/*.cpp") , then godot can load the dll

Steps to reproduce

Folder -- cplugin     -- Frameworks         xx.h         xx.cpp         -- Objects             xx.h             xx.cpp -- godot-cpp -- project (godot project files)

Minimal reproduction project

none

MYTNB avatar Jun 21 '25 17:06 MYTNB

Glob("cplugin/Frameworks/.cpp") + Glob("cplugin/Frameworks/Objects/.cpp")

this line is the issue, you need to put a * before the .cpp

Glob("cplugin/Frameworks/*.cpp") + Glob("cplugin/Frameworks/Objects/*.cpp")

I would also recommend putting each Glob on each line like so

sources = Glob("cplugin/*.cpp")
sources.Append(Glob("cplugin/Frameworks/Objects/*.cpp"))
sources.Append(Glob("cplugin/Frameworks/*.cpp") )

as it makes it easier to reason about how these lists are added together. and if need be I'd also recommend adding

recursive = True 

to them I.E.

sources = Glob("cplugin/*.cpp",recursive = True)

so you don't have to manually add each directory when a new one is made

though if you want to exclude some directories adding each sub-directory individually with recursive = True would be a way to go

xana43 avatar Aug 19 '25 02:08 xana43

@MYTNB did this solve your problem? can this issue now be closed?

enetheru avatar Oct 18 '25 07:10 enetheru