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

Visual Studio 2022 GDExtension C++ ".lib" binding error #1327

Closed
kone9 opened this issue Dec 3, 2023 · 74 comments
Closed

Visual Studio 2022 GDExtension C++ ".lib" binding error #1327

kone9 opened this issue Dec 3, 2023 · 74 comments
Labels

Comments

@kone9
Copy link

kone9 commented Dec 3, 2023

Godot version

4.2 stable

System information

windows 11, intel i5 10ma, rx 6600 xt,godot 4.2 stable

Issue description

Compile GDextension with Visual studio 2022, I can run godot, but it does not compile correctly, it seems that there is a problem and incompatibility with the .lib generated with the binding in godot-cpp

libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj

02_ErrorVisualStudioGDExtension
01_ErrorVisualStudioGDExtension
04_ErrorVisualStudioGDExtension
16_configuration

Steps to reproduce

in windows 11
install visual studio 2022 with libraries, python, scons and git.
17_configuration

Download this template project that is fully configured and press F5, you will see that it loads the game from godot, but it does not compile
https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

try to generate the .lib in godot-cpp with different configurations,
For example, I already tried this one and it doesn't work.
Captura de pantalla 2023-12-03 153455

scons platform=windows custom_api_file=gdextension\extension_api.json generate_bindings=yes

The issue is that Visual Studio does not need scons to generate the DLL, but to generate the .lib you have to use scons. I don't know what the error would be, but it seems that there is a problem with the .lib generated with scons in godot-cpp

Minimal reproduction project

I created this project where it is explained in detail how to configure Visual Studio with GDextension, but for some reason it doesn't work. I also want to clarify that I did this configuration previously with GDnative and it did work, although obviously the includes were different.
Please look at this project carefully because it contains all the configurations in visual studio 2022 in detail and it is an example of a downloadable template that should be able to be used anywhere.
Open the project with visual studio 2022 stable version

https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

@AThousandShips
Copy link
Member

Did you compile both with disable_extensions=True?

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

GDNative isn't supported in 4.2, do you mean GDExtension?

Yes, sorry... sorry I was wrong... The problem is with GDextension.

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

disable_extensions=True

Where do I add that? When do I generate the bindings in godot cpp? I mean, it would be like this.

scons platform=windows custom_api_file=gdextension\extension_api.json generate_bindings=yes disable_extensions=True

@AThousandShips
Copy link
Member

Yes, I'm unsure exactly what's wrong here, will look when I have time 🙂

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

Yes, I'm unsure exactly what's wrong here, will look when I have time 🙂

It seems that there is a problem with the generation of the binding that generates an incompatibility with VScode. I leave a mini video showing the problem
https://youtu.be/JhllJgHI1nM

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

Yes, I'm unsure exactly what's wrong here, will look when I have time 🙂

Try generating the bindings in the following way. It still doesn't work.

scons platform=windows custom_api_file=gdextension\extension_api.json generate_bindings=yes disable_extensions=true
Captura de pantalla 2023-12-03 155837

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

I also want to say that I have this project running in VScode for both Windows and Linux Ubuntu and it works very well there.
I only need Visual Studio.

https://gitlab.com/kone9/godot-engine-4.2-template-gdextension-with-vscode-windows-11
https://gitlab.com/kone9/godot-engine-4.2-template-gdextension-with-vscode

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

Will it be possible to generate the .lib directly from Visual Studio without using Scons???

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

Yes, I'm unsure exactly what's wrong here, will look when I have time 🙂

When trying to solve this problem, please try creating the .lib with visual studio. Esaa without using scons, to document the entire GDnative compilation procedure with Visual Studio. This would bring many advantages and a pre-configured project could be created that is updated in each version of godot. It would be much easier than using Scons, at least in Windows.
Captura de pantalla 2023-12-03 172732
Captura de pantalla 2023-12-03 172826

@crashfort
Copy link

#1319 fixes this. You have to build godot-cpp with scons but the extension dll you can use Visual Studio for.

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

godotengine/godot-cpp#1319 fixes this. You have to build godot-cpp with scons but the extension dll you can use Visual Studio for.

There is no possibility of compiling the static library directly with Visual Studio? I know that in Linux the process is easy, but in Windows it would be much simpler to have a template with Visual Studio and be able to generalize both the DLL and the static library... I'm going Let's try this and see if it works for me

scons platform=windows -j15 custom_api_file="..\Godot_v4.2-rc2_win64\extension_api.json" target=template_release use_static_cpp=no optimize=speed debug_symbols=yes

But I insist, you don't know how to configure visual studio to generate the static library directly from visual studio?

@crashfort
Copy link

I mean I don't see the point in using VS for godot-cpp since you only have to do that once, ever. For your actual extension dll you can use a VS vcxproj without scons, that's what I do because I don't want to use scons for anything.

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

I mean I don't see the point in using VS for godot-cpp since you only have to do that once, ever. For your actual extension dll you can use a VS vcxproj without scons, that's what I do because I don't want to use scons for anything.

You have to download scons, python and make configurations that waste your time. Many people have already told me that they are not encouraged with C++ godot or that it is not worth the effort to learn the procedure with GDextension and C++ because the configuration is a lot of work, I mean apart from that there is the whole issue of including libraries, configuring the dubug with visual studio, etc..

That's why I think the ideal would be to have a repository with a Visual Studio 2022 project that already contains the Godot-Cpp and even a built-in godot engine editor so that by simply touching a button you can generate the bindings and with another button run the game or the direct editor from visual studio..

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

I mean I don't see the point in using VS for godot-cpp since you only have to do that once, ever. For your actual extension dll you can use a VS vcxproj without scons, that's what I do because I don't want to use scons for anything.

You know, I just compiled with the command you sent in debug mode, but it still doesn't work, I'm testing it in this project.

scons platform=windows custom_api_file="gdextension\extension_api.json" target=template_debug use_static_cpp=no optimize=debug debug_symbols=yes

https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

@crashfort
Copy link

You need to rebuild godot-cpp with that change applied, not run the commands that are specified there. Of course you will get the same error.

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

You need to rebuild godot-cpp with that change applied, not run the commands that are specified there. Of course you will get the same error.

Build started at 20:31...
1>------ Build started: Project: GDExtensionVS, Configuration: Game_Debug_Godot x64 ------
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1>libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(memory.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(memory.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(char_string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(char_string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(editor_plugin_registration.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(editor_plugin_registration.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_arrays.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_arrays.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(plane.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(plane.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in register_types.obj
1> Creating library .\Godot_proyect\bin\GDExtensionVS.lib and object .\Godot_proyect\bin\GDExtensionVS.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>.\Godot_proyect\bin\GDExtensionVS.dll : fatal error LNK1319: 90 mismatches detected
1>Done building project "GDExtensionVS.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 20:31 and took 00,354 seconds ==========

@crashfort
Copy link

No, you need to build godot-cpp, not your extension.

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

You need to rebuild godot-cpp with that change applied, not run the commands that are specified there. Of course you will get the same error.

I have created the bindings en godot-cpp again, but they don't work.
Captura de pantalla 2023-12-03 203322

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

No, you need to build godot-cpp, not your extension.

Captura de pantalla 2023-12-03 203559

scons platform=windows custom_api_file="gdextension\extension_api.json" target=template_debug use_static_cpp=no optimize=debug debug_symbols=yes

scons platform=windows custom_api_file="gdextension\extension_api.json" target=template_release use_static_cpp=no optimize=speed debug_symbols=yes

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

No, you need to build godot-cpp, not your extension.

Captura de pantalla 2023-12-03 203819

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

No, you need to build godot-cpp, not your extension.

Captura de pantalla 2023-12-03 203954

@kone9
Copy link
Author

kone9 commented Dec 3, 2023

No, you need to build godot-cpp, not your extension.

Quickly try my project, I have already compiled the static libraries and uploaded them to the repository, you will see that it does not work.

https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

You need to rebuild godot-cpp with that change applied, not run the commands that are specified there. Of course you will get the same error.

Where do I add this?.. I don't understand your answer.
Captura de pantalla 2023-12-03 214154

@akien-mga akien-mga transferred this issue from godotengine/godot Dec 4, 2023
@DmitriySalnikov
Copy link
Contributor

DmitriySalnikov commented Dec 4, 2023

Just use /MT here:
image

And remove _DEBUG from the preprocessor:
image

Also for Windows you have to add TYPED_METHOD_BIND and NOMINMAX to the preprocessor.
https://github.com/godotengine/godot-cpp/blob/master/tools/windows.py#L33

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

Just use /MT here: image

And remove _DEBUG from the preprocessor: image

Also for Windows you have to add TYPED_METHOD_BIND and NOMINMAX to the preprocessor. https://github.com/godotengine/godot-cpp/blob/master/tools/windows.py#L33

What do you mean by Also "for Windows you have to add TYPED_METHOD_BIND and NOMINMAX to the preprocessor."

Where is that added? .. In the windows.py file in godot-cpp this is already included ..

Is it a visual studio option?

add the options to visual studio that you mention, but it still does not compile

@DmitriySalnikov
Copy link
Contributor

add the options to visual studio that you mention, but it still does not compile

Logs?

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

Add this but still not working
Captura de pantalla 2023-12-04 104924
Captura de pantalla 2023-12-04 105039

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

add the options to visual studio that you mention, but it still does not compile

Logs?

Build started at 10:52...
1>------ Build started: Project: GDExtensionVS, Configuration: Editor_Debug_Godot x64 ------
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1>libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(memory.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(memory.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(char_string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(char_string.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(editor_plugin_registration.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(editor_plugin_registration.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_arrays.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_arrays.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(plane.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(plane.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in register_types.obj
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MTd_StaticDebug' in register_types.obj
1> Creating library .\Godot_proyect\bin\GDExtensionVS.lib and object .\Godot_proyect\bin\GDExtensionVS.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4217: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj)' in function '"void __cdecl godot::_err_flush_stdout(void)" (?_err_flush_stdout@godot@@yaxxz)'
1>LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)'
1>LINK : warning LNK4217: symbol 'fflush' defined in 'libucrt.lib(fflush.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(error_macros.windows.template_debug.x86_64.obj)' in function '"void __cdecl godot::_err_flush_stdout(void)" (?_err_flush_stdout@godot@@yaxxz)'
1>LINK : warning LNK4217: symbol 'free' defined in 'libucrt.lib(free.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)' in function '"public: __cdecl godot::GDExtensionBinding::InitDataList::~InitDataList(void)" (??1InitDataList@GDExtensionBinding@godot@@qeaa@XZ)'
1>LINK : warning LNK4217: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)' in function '_vfprintf_l'
1>LINK : warning LNK4217: symbol '__stdio_common_vsprintf' defined in 'libucrt.lib(output.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)' in function 'vsnprintf'
1>LINK : warning LNK4217: symbol '_invalid_parameter_noinfo_noreturn' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj)' in function '"void * __cdecl std::_Allocate_manually_vector_aligned(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)'
1>LINK : warning LNK4286: symbol '_invalid_parameter_noinfo_noreturn' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj)'
1>LINK : warning LNK4286: symbol '_invalid_parameter_noinfo_noreturn' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj)'
1>LINK : warning LNK4217: symbol '_invoke_watson' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj)' in function '"protected: virtual void __cdecl stdext::bad_alloc::_Doraise(void)const " (?_Doraise@bad_alloc@stdext@@MEBAXXZ)'
1>LINK : warning LNK4286: symbol '_invoke_watson' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj)'
1>LINK : warning LNK4286: symbol '_invoke_watson' defined in 'libucrt.lib(invalid_parameter.obj)' is imported by 'libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj)'
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_realloc referenced in function "public: void __cdecl godot::GDExtensionBinding::InitDataList::add(struct godot::GDExtensionBinding::InitData *)" (?add@InitDataList@GDExtensionBinding@godot@@QEAAXPEAUInitData@23@@z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(char_string.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_floor referenced in function "public: static class godot::String __cdecl godot::String::num_real(double,bool)" (?num_real@String@godot@@sa?AV12@N_N@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_floor
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_ceilf referenced in function "protected: unsigned __int64 __cdecl std::_Hash<class std::_Umap_traits<class godot::StringName,struct GDExtensionInstanceBindingCallbacks const *,class std::_Uhash_compare<class godot::StringName,struct std::hash,struct std::equal_to >,class std::allocator<struct std::pair<class godot::StringName const ,struct GDExtensionInstanceBindingCallbacks const *> >,0> >::_Min_load_factor_buckets(unsigned __int64)const " (?_Min_load_factor_buckets@?$_Hash@V?$_Umap_traits@VStringName@godot@@PEBUGDExtensionInstanceBindingCallbacks@@v?$_Uhash_compare@VStringName@godot@@U?$hash@VStringName@godot@@@std@@U?$equal_to@VStringName@godot@@@4@@std@@v?$allocator@U?$pair@$$CBVStringName@godot@@PEBUGDExtensionInstanceBindingCallbacks@@@std@@@5@$0A@@std@@@std@@IEBA_K_K@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_ceilf
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_acosf referenced in function "float __cdecl godot::Math::acos(float)" (?acos@Math@godot@@yamm@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_acosf
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_acosf
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_cosf referenced in function "float __cdecl godot::Math::cos(float)" (?cos@Math@godot@@yamm@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_cosf
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_cosf
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_sinf referenced in function "float __cdecl godot::Math::sin(float)" (?sin@Math@godot@@yamm@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sinf
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sinf
1>libgodot-cpp.windows.template_debug.x86_64.lib(quaternion.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_sqrtf referenced in function "public: __cdecl godot::Quaternion::operator class godot::String(void)const " (??BQuaternion@godot@@qeba?AVString@1@XZ)
1>libgodot-cpp.windows.template_debug.x86_64.lib(projection.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sqrtf
1>libgodot-cpp.windows.template_debug.x86_64.lib(plane.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sqrtf
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sqrtf
1>libgodot-cpp.windows.template_debug.x86_64.lib(vector3.windows.template_debug.x86_64.obj) : error LNK2001: unresolved external symbol __imp_sqrtf
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_asinf referenced in function "float __cdecl asin(float)" (?asin@@yamm@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_atan2f referenced in function "float __cdecl atan2(float,float)" (?atan2@@yammm@Z)
1>libgodot-cpp.windows.template_debug.x86_64.lib(basis.windows.template_debug.x86_64.obj) : error LNK2019: unresolved external symbol __imp_atanf referenced in function "float __cdecl godot::Math::atan(float)" (?atan@Math@godot@@yamm@Z)
1>.\Godot_proyect\bin\GDExtensionVS.dll : fatal error LNK1120: 10 unresolved externals
1>Done building project "GDExtensionVS.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 10:52 and took 00,424 seconds ==========

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

add the options to visual studio that you mention, but it still does not compile

Logs?

try the project directly
https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

@kone9
Copy link
Author

kone9 commented Dec 4, 2023

PROBLEM SOLUTION

Template project uploaded to gitlab. I uploaded it to Gitlab because the free Gitlab repositories support up to 10 GB and this is important because I upload the precompiled static libraries and all the godot-cpp. Even if it is possible, I will try to add a blender3D within the same repository... Just download the project and not have to do any type of configuration.

https://gitlab.com/kone9/visual-studio-godot-engine-gdextension-cpp-template

This proyect have 4 solutions

debug mode and release mode. You can run the game directly from visual studio or open the godot editor.
If you select game, open the game, if you select editor, open the editor.
For development, debug mode compilations are recommended, for final compilations release mode.

  • Editor_Debug_Godot
  • Editor_Release_Godot
  • Game_Debug_Godot
  • Game_Release_Godot

Captura de pantalla 2023-12-04 191858

Here are all the steps in a single Comment.

01_logo

Captura de pantalla 2023-12-04 185606

Captura de pantalla 2023-12-04 191624

To generate the visual studio compatible static libraries that are saved in godot-cpp/bin use the following scons command.

lib debug:

scons platform=windows custom_api_file="gdextension\extension_api.json" target=template_debug optimize=debug debug_symbols=yes

lib release

scons platform=windows custom_api_file="gdextension\extension_api.json" target=template_release optimize=speed debug_symbols=yes

Note that extension_api.json in godot-cpp 4.2 is located inside gdextension\extension_api.json.

Pay attention to the location of "extension_api.json"

Captura de pantalla 2023-12-04 142631

Then in the project properties you have to add the following settings

Captura de pantalla 2023-12-04 115832

General

  • directory goes to the location where the dll is compiled, that is, inside the game project directory, this is the dll that works with GDextension
  • add this name to the dll that exits visual studio libgdexample.windows.template_debug.x86_64
  • Dynamic Library (.dll) configuration type
  • C++ Language Standart C++ 17

Captura de pantalla 2023-12-04 133531

Debugging

  • Command "You have to add the path to the Godot executable"
  • Working Directory "You have to add the path to the Godot project, by default the main scene will be executed"
  • Command Arguments Alternatively you can add command arguments such as "--editor" to run the editor instead of the game within visual studio, you can create different configurations within the editor.

debugging

debugging_02

VCC Directories

  • Include Directories the paths go to the bookstore
  • Library Directoria path to the preconfigured binding that is in Godot-cpp/bin

03_configuration
04_configuration
05_configuration

C/C++

Preprocessor

  • in preprocessor definitions add WIN64 TYPED_METHOD_BIND NOMINMAX HOT_RELOAD_ENABLED _CONSOLE

Captura de pantalla 2023-12-10 220442

Captura de pantalla 2023-12-10 220703

Code Generation

  • Runtime Library Multi-treaded (/MT)
    Captura de pantalla 2023-12-04 141342

Linker

General

  • "Additional Library Directories" Again you add the Library Directoria path to the preconfigured binding that is in Godot-cpp/bin
    07_configuration
    08_configuration

Input

  • "Additional Dependencies" Here you have to add the name of the binding generated from godot-cpp that is located within the godot-cpp/bin folder
    09_configuration
    10_configuration

Don't forget the "gdexample.gdextension" that goes inside the godot project and generates that link between gdextension and godot.

Also very important to set the property [configuration] reloadable = true so that when creating signals you do not have to restart the editor.
Anyway, check out the official GDextension documentation.
https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/gdextension_cpp_example.html

Captura de pantalla 2023-12-10 215222

Captura de pantalla 2023-12-10 222053

Visual Studio 2022 stable, Python, Scons, windows 11

17_configuration

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

Yes, I already have those configurations in Visual Studio.

Then, most likely, I misunderstood. Have you changed the names of libraries in .gdextension. You need to specify the correct paths to your libraries in this file. Or use the expression as the target name libgdexample.windows.$(Configuration).$(LlvmPlatformName). But then you need to rename the Solution Configurations and Project Configurations. You need to replace Debug and Release with template_debug and template_release to match the names from the example.

image image

Excuse me for asking you...
By chance you know why hot reload doesn't work with visual studio when I start with the editor.
I mean, if I start the game only in window mode, the hot reload works in visual studio and I can change everything while running, but if I start in editor mode, that is, I open the editor while debugging, the hot reliad does not work.

@DmitriySalnikov
Copy link
Contributor

that is, I open the editor while debugging, the hot reliad does not work.

Do you mean that you open Project Manager first and then Edit your project?

If so, the debugger will not work because the Project Manager closes and a new process opens. It is best to specify the project folder as a working directory in Project Properties - Debugging and specify the -e argument.
In this case, the editor with your project will open and the debugger will work.

Next, there may only be problems with flags that Visual Studio itself will report when you click on Hot-Reload (it seems).

I don't remember my Visual Studio not being able to use Hot-Reload. The library and debugging symbols are always picked up on the fly, even with the new hot reload system in godot itself (4.2+).

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

Do you mean that you open Project Manager first and then Edit your project?

If so, the debugger will not work because the Project Manager closes and a new process opens. It is best to specify the project folder as a working directory in Project Properties - Debugging and specify the -e argument. In this case, the editor with your project will open and the debugger will work.

Next, there may only be problems with flags that Visual Studio itself will report when you click on Hot-Reload (it seems).

I don't remember my Visual Studio not being able to use Hot-Reload. The library and debugging symbols are always picked up on the fly, even with the new hot reload system in godot itself (4.2+).

open the project directly in debug mode, use --editor.
The issue is that dubug doesn't work, it doesn't even work when I put an interruption in the code, but it only happens in editor mode, in direct game run mode it doesn't happen.
The problem is that hot reloading does not work in editor mode either.
Captura de pantalla 2023-12-10 014659
Captura de pantalla 2023-12-10 020748

video showing that error
https://youtu.be/VOAugGN4tlo

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

that is, I open the editor while debugging, the hot reliad does not work.

Do you mean that you open Project Manager first and then Edit your project?

If so, the debugger will not work because the Project Manager closes and a new process opens. It is best to specify the project folder as a working directory in Project Properties - Debugging and specify the -e argument. In this case, the editor with your project will open and the debugger will work.

Next, there may only be problems with flags that Visual Studio itself will report when you click on Hot-Reload (it seems).

I don't remember my Visual Studio not being able to use Hot-Reload. The library and debugging symbols are always picked up on the fly, even with the new hot reload system in godot itself (4.2+).

In this video you can also see that hot reload does not work in editor mode, only in game mode, I have exactly the same configuration, only I start editor mode.
https://www.youtube.com/watch?v=bUqTAcMdYjE

@DmitriySalnikov
Copy link
Contributor

As far as I understand, this is the correct behavior, because debugging is started for only one process - for the editor. A running project is a different process.

You can attach to a running project manually via the Debug menu.
image

But also keep in mind that Hot-reload does not change the library during debugging and the project being launched will also not change during restarts.

In order for the changes to be applied to the project being launched, it is better to look towards hot-reload in godot 4.2 itself godotengine/godot#80284
In short: update godot-cpp to 4.2 and add reloadable = true to .gdextension.

[configuration]

entry_symbol = "example_init"
compatibility_minimum = "4.2"
reloadable = true

You also need to add the HOT_RELOAD_ENABLED preprocessor flag to the visual studio project if you are going to build via it. But visual studio will not allow you to rebuild the project while debugging is running. Therefore, you will need to run the build via scons during debugging. But this will lead to the fact that the pdb files will be blocked by Visual Studio and you need to create new ones every time (reference).

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

You also need to add the HOT_RELOAD_ENABLED preprocessor flag to the visual studio project if you are going to build via it. But visual studio will not allow you to rebuild the project while debugging is running. Therefore, you will need to run the build via scons during debugging. But this will lead to the fact that the pdb files will be blocked by Visual Studio and you need to create new ones every time (reference).

Here they talk about the problem of GDextension and hot reloading, it seems that it does not work correctly when we enable it.
Since the exact same problem happened to me.
The issue is that GDnative did support hot loading, at least to connect signals.
In my chaos I am now testing it on Windows with Visual Studio, then I will try it on Linux with Scons.

godotengine/godot#66231

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

As far as I understand, this is the correct behavior, because debugging is started for only one process - for the editor. A running project is a different process.

You can attach to a running project manually via the Debug menu. image

But also keep in mind that Hot-reload does not change the library during debugging and the project being launched will also not change during restarts.

In order for the changes to be applied to the project being launched, it is better to look towards hot-reload in godot 4.2 itself godotengine/godot#80284 In short: update godot-cpp to 4.2 and add reloadable = true to .gdextension.

[configuration]

entry_symbol = "example_init"
compatibility_minimum = "4.2"
reloadable = true

You also need to add the HOT_RELOAD_ENABLED preprocessor flag to the visual studio project if you are going to build via it. But visual studio will not allow you to rebuild the project while debugging is running. Therefore, you will need to run the build via scons during debugging. But this will lead to the fact that the pdb files will be blocked by Visual Studio and you need to create new ones every time (reference).

Implement reloading of GDExtensions
godotengine/godot#80284

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

In short: update godot-cpp to 4.2 and add reloadable = true to .gdextension.

You know I was doing tests and
" reloadable = true to .gdextension. " only works on linux ubuntu when I use VScode.

If I do it on Windows with vscode, it tells me a permissions error with pdb.
Godot's edit also throws an error.

When I compile with VScode on Windows I do use Scons

Captura de pantalla 2023-12-10 150804

Captura de pantalla 2023-12-10 145528

Captura de pantalla 2023-12-10 145551

LAUNCH.JSON


{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Editor Debug Godot GDNative",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "${workspaceFolder}/External_Programs/Godot_Editor/Godot_v4.2-stable_win64.exe", // Ajusta la ruta según tu instalación de Godot en Windows
      "args": ["--path", "${workspaceFolder}/Godot_proyect", "--editor"],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "stopOnEntry": false,
      "serverLaunchTimeout": 5000,
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "GODOT_BUILD_GDnative_C++_DLL_DEBUG_Win" // Asegúrate de tener una tarea preLaunch configurada para compilar tu proyecto antes de ejecutarlo
    },
    {
      "name": "Game Debug Godot GDNative",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "${workspaceFolder}/External_Programs/Godot_Editor/Godot_v4.2-stable_win64.exe", // Ajusta la ruta según tu instalación de Godot en Windows
      "args": ["--path", "${workspaceFolder}/Godot_proyect"],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "stopOnEntry": false,
      "serverLaunchTimeout": 5000,
      "preLaunchTask": "GODOT_BUILD_GDnative_C++_DLL_DEBUG_Win" // Asegúrate de tener una tarea preLaunch configurada para compilar tu proyecto antes de ejecutarlo
    }
  ]
}

TASKS.JSON

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "shell",
      "label": "GODOT_BUILD_GDnative_C++_DLL_DEBUG_Win",
      "command": "scons",
      "args": [
        "platform=windows",
        "target=template_debug",
        "debug_symbols=yes"
      ],
      "options": {
        "env": {
          "VSCODE_TASK_UID": "GODOT_BUILD_SUCCESS_MESSAGE"
        }
      },
      "problemMatcher": {
        "base": "$gcc",
        "fileLocation": [
          "relative",
          "${workspaceFolder}"
        ],
        "pattern": {
          "regexp": "^(.*):(\\d+):(\\d+):\\s+(error|warning):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      },
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "silent",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false,
        "clear": true,
        "echo": true,
        "errors": "always",
        "warnings": "always",
        "info": "always",
        "statusBar": {
          "text": "$(globe) Godot Project: Godot_Project",
          "color": "red"
        }
      }
    }
  ],
  "group": {
    "kind": "build",
    "isDefault": true
  }
}

With Visual Studio it seems the same, there is a strange error there that does not allow the plugin to be reloaded in Windows.

@DmitriySalnikov
Copy link
Contributor

Can you read the last section of my previous message again?

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

You also need to add the HOT_RELOAD_ENABLED preprocessor flag to the visual studio project if you are going to build via it. But visual studio will not allow you to rebuild the project while debugging is running. Therefore, you will need to run the build via scons during debugging. But this will lead to the fact that the pdb files will be blocked by Visual Studio and you need to create new ones every time (reference).

modify the previous comment.
In vscode it also crashes when I use scons.
Even if I compile directly in the console while the debug is running.
There is a problem with permissions, but it doesn't happen in Linux, only in Windows.
Captura de pantalla 2023-12-10 151139

@DmitriySalnikov
Copy link
Contributor

Again:

But this will lead to the fact that the pdb files will be blocked by Visual Studio and you need to create new ones every time (reference).

In your scons script, you need to check the availability of the PDB for writing at each build and create new ones if the old ones are blocked. In the reference is my code that works correctly for me. It needs to be adapted for your project and that's it.

There is a problem with permissions, but it doesn't happen in Linux, only in Windows.

Linux allows you to delete executable files after startup...

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

In your scons script, you need to check the availability of the PDB for writing at each build and create new ones if the old ones are blocked. In the reference is my code that works correctly for me. It needs to be adapted for your project and that's it.

So the problem is the Sconstructor that they share from the official GDextension website then?
I'll copy and paste yours to see if it works at least in VScode.
Captura de pantalla 2023-12-10 152002
Captura de pantalla 2023-12-10 152238

@DmitriySalnikov
Copy link
Contributor

I'll copy and paste yours to see if it works at least in VScode.

I do not recommend doing this. I have a script made for my library with its own features and file structure.

Here is a script from the documentation that I have modified so that it automatically renames the PDB:

#!/usr/bin/env python
import os
import sys
from pathlib import Path

env = SConscript("../SConstruct")

bin_dir = "project/bin"


def is_file_locked(file_path):
    if not os.path.exists(file_path):
        return False
    try:
        with open(file_path, "a") as f:
            pass
    except IOError:
        return True
    return False


def msvc_pdb_rename(env, lib_full_name):
    new_name = (Path(bin_dir) / lib_full_name).as_posix()
    max_files = 256

    # clean up the old PDBs if possible
    onlyfiles = [
        f
        for f in os.listdir(Path(bin_dir))
        if os.path.isfile(os.path.join(Path(bin_dir), f)) and f.endswith(".pdb") and f.startswith(lib_full_name)
    ]
    # sort by time and leave only the newest PDB
    onlyfiles = sorted(onlyfiles, key=lambda x: os.path.getmtime(os.path.join(bin_dir, x)))[:-1]
    for of in onlyfiles:
        try:
            os.remove(Path(bin_dir) / of)
        except:
            pass

    # search for a non-blocked PDB name
    pdb_name = ""
    for s in range(max_files):
        pdb_name = "{}_{}.pdb".format(new_name, s)
        if not is_file_locked(pdb_name):
            break

    # explicit assignment of the PDB name
    env.Append(LINKFLAGS=["/PDB:" + pdb_name])


# For reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags

# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")

if env["platform"] == "macos":
    library = env.SharedLibrary(
        "{}/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
            bin_dir, env["platform"], env["target"], env["platform"], env["target"]
        ),
        source=sources,
    )
else:
    if env.get("is_msvc", False) and env["target"] != "template_release":
        msvc_pdb_rename(env, "libgdexample{}".format(env["suffix"]))

    library = env.SharedLibrary(
        "{}/libgdexample{}{}".format(bin_dir, env["suffix"], env["SHLIBSUFFIX"]),
        source=sources,
    )

Default(library)

And this still doesn't apply to godot-cpp itself. This is what you have to do yourself to build your libraries. But you can suggest updating the documentation or example project to add the code that I wrote above.
Please explore more examples of working with scons and use search engines or even GPT more.

I am not ready to help further, I have my own tasks.

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

And this still doesn't apply to godot-cpp itself. This is what you have to do yourself to build your libraries. But you can suggest updating the documentation or example project to add the code that I wrote above. Please explore more examples of working with scons and use search engines or even GPT more.

I am not ready to help further, I have my own tasks.

Okay, thank you very much. I was trying to do exactly the same thing.
I'm going to do a pullrequest with your script.

@DmitriySalnikov
Copy link
Contributor

I'm going to do a pullrequest with your script.

I will do it myself now, as I found a similar issue in godot repo. godotengine/godot#82536

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

I'm going to do a pullrequest with your script.

I will do it myself now, as I found a similar issue in godot repo. godotengine/godot#82536

Great, thank you very much for your time. I value it a lot.
So at least I will make a video in Spanish showing this correction and its correct operation.
I have already verified that it works correctly and uploaded a commit to the repository that I have as a template.
https://gitlab.com/kone9/godot-engine-4.2-template-gdextension-with-vscode-windows-11

@kone9
Copy link
Author

kone9 commented Dec 10, 2023

I'm going to do a pullrequest with your script.

I will do it myself now, as I found a similar issue in godot repo. godotengine/godot#82536

Now I only need Visual Studio.
But don't worry, I already understood the problem and the solution.
I'm going to try to figure it out for myself.
Thank you so much!.

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

Hello, I just want to say that in visual studio after adding the following HOT_RELOAD_ENABLED command in the "preprocessor flag" and in gdexample.gdextension in configuration reloadable = true I can add signals without having to restart the editor.

Captura de pantalla 2023-12-10 215410
Captura de pantalla 2023-12-10 215504
Captura de pantalla 2023-12-10 215535
Captura de pantalla 2023-12-10 215222
Captura de pantalla 2023-12-10 215320

It does not work in debug mode, but at least it is not necessary to restart the editor, which is very important.
Possibly, as I was told, in debug mode for some reason access to the file is blocked and it cannot be overwritten.
But at least if the editor is open, it is not necessary to restart the editor every time you create a signal with GDextension C+.

Beyond this, what seems very strange to me is that if the game is run directly the hot reload works, but when it is run in editor mode it does not work.

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

I am going to continue documenting Visual Studio errors here with the topic of debugging with hot reload.

Now that the saving is working, you see that there is an error with the PDB file and it is not because there are no debugging symbols, it seems that it is looking for an .obj that it cannot find.

1>libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions. windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info

Build started at 23:05...
1>------ Build started: Project: GDExtensionVS, Configuration: Editor_Debug_Godot x64 ------
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(collision_object3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(collision_object3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(engine.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(engine.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node2d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node2d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(visual_instance3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(visual_instance3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>GDExtensionVS.vcxproj -> C:\Users\ARIEL\Documents\Visual Studio proyectos\GDExtensionVS - copia\Godot_proyect\bin\libgdexample.windows.template_debug.x86_64.dll
1>Done building project "GDExtensionVS.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 23:05 and took 00,951 seconds ==========

✔️ Build has completed

Failed to apply change with code 0x81510017.
Hot Reload : ❌ error NEN1500 : Failed to resolve section with contributions 0x59645EA7, 0x00000000, 0xC0100040, 0x000000C6 (relocation #1 in section 'godot::CuboExample::_ready' [?_ready@CuboExample@godot@@UEAAXXZ]). (c:\users\ariel\documents\visual studio proyectos\gdextensionvs - copia\x64\editor_debug_godot\cuboexample.new.obj.enc)
❌ An error occurred while applying code changes.

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

I am going to continue documenting Visual Studio errors here with the topic of debugging with hot reload.

Now that the saving is working, you see that there is an error with the PDB file and it is not because there are no debugging symbols, it seems that it is looking for an .obj that it cannot find.

1>libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions. windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info

Build started at 23:05...
1>------ Build started: Project: GDExtensionVS, Configuration: Editor_Debug_Godot x64 ------
1>libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(godot.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(wrapped.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(method_bind.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(variant.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(string.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(string_name.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node_path.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(rid.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(callable.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(signal.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(dictionary.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_byte_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_int32_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_int64_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_float32_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_float64_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_string_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector2_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_vector3_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(packed_color_array.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(canvas_item.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(class_db_singleton.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(collision_object3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(collision_object3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(engine.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(engine.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(main_loop.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(material.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(mesh.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node2d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node2d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(node3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(node3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(object.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(ref_counted.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(resource.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(style_box.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(texture2d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(visual_instance3d.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(visual_instance3d.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(window.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj) : warning LNK4099: PDB '' was not found with 'libgodot-cpp.windows.template_debug.x86_64.lib(utility_functions.windows.template_debug.x86_64.obj)' or at ''; linking object as if no debug info
1>GDExtensionVS.vcxproj -> C:\Users\ARIEL\Documents\Visual Studio proyectos\GDExtensionVS - copia\Godot_proyect\bin\libgdexample.windows.template_debug.x86_64.dll
1>Done building project "GDExtensionVS.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 23:05 and took 00,951 seconds ==========
✔️ Build has completed

Failed to apply change with code 0x81510017.
Hot Reload : ❌ error NEN1500 : Failed to resolve section with contributions 0x59645EA7, 0x00000000, 0xC0100040, 0x000000C6 (relocation #1 in section 'godot::CuboExample::_ready' [?_ready@CuboExample@godot@@UEAAXXZ]). (c:\users\ariel\documents\visual studio proyectos\gdextensionvs - copia\x64\editor_debug_godot\cuboexample.new.obj.enc)
❌ An error occurred while applying code changes.

When you compile a program in Visual Studio, Program Database (PDB) files are generated that contain debugging information. These PDB files are useful for debugging code and detailed tracing during program execution. The linker searches for these PDB files to associate debugging information with the executable code.

Setting PDB file search paths in Visual Studio allows you to specify the locations where the linker should search for the corresponding PDB files during program execution.

Here is a step-by-step guide to verify and configure PDB file search paths in Visual Studio:

Open your project in Visual Studio.

From the menu, select "View" and then "Property Manager." This will open the Project Property Manager.

In the Property Manager, you will find settings for various platforms and configurations (for example, Debug and Release). Select the specific configuration you are using (for example, "Debug").

Expand the selected settings and look for the "Microsoft.Cpp.x64.user" category (or "Microsoft.Cpp.Win32.user" for 32-bit platforms).

Inside "Microsoft.Cpp.x64.user", look for the "Linker" section and expand "Debugging".

In the "Debugging" section, you'll find a property called "AdditionalSymbolDirectories" (or similar). This is where you can specify search paths for additional PDB files.

Make sure the paths specified here are correct and point to the directories where the PDB files needed for your project are located.

Save changes to the project settings.

This process may vary slightly depending on the specific version of Visual Studio you are using, but will generally follow a similar structure. The main idea is to adjust the settings related to the linker and search paths to ensure that the PDB files can be found during program execution.

Remember that PDB file search paths are important for debugging, so it's critical to ensure they are set correctly to avoid linking issues during development.

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

In the compiler options, there seems to be an option that allows you to forcibly rewrite the file called /FS however I tried it but it doesn't work.

It is an option in the visual studio compiler, but I can't find the way around it.

Captura de pantalla 2023-12-11 012057

Captura de pantalla 2023-12-11 012132

https://learn.microsoft.com/en-us/cpp/build/reference/fs-force-synchronous-pdb-writes?view=msvc-160

https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=msvc-160

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

I have also tried with /Z7, /Zi, /ZI but there is no case, it does not work with any of them in godot editor mode.
Captura de pantalla 2023-12-11 013826

https://learn.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-160

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

Another thing could be to create a power shell script to overwrite the file before compiling... ChatGPT suggested this to me, it runs, but it still doesn't work... Possibly this is the best and most personalized option within visual studio on Windows.

Captura de pantalla 2023-12-11 021917

So go to the following location and run the script before the build runs.
"Configuration Properties" > "Build Events" > "Post-Build Event".
Captura de pantalla 2023-12-11 022004

powershell -ExecutionPolicy Bypass -File "$(ProjectDir)\RenamePDB.ps1"
Captura de pantalla 2023-12-11 022402

I leave the code of that script here just in case.

RenamePDB.ps1

param (
    [string]$relativeBinDir = "Godot_proyect\bin",
    [string]$libFullName = "libgdexample"
)

# Obtener la ruta completa al directorio de destino
$fullBinDir = Join-Path -Path (Get-Location) -ChildPath $relativeBinDir

# Función para verificar si un archivo está bloqueado
function Test-FileLocked {
    param (
        [string]$filePath
    )

    if (Test-Path $filePath) {
        try {
            $null = [System.IO.File]::OpenWrite($filePath).Close()
            $false
        }
        catch {
            $true
        }
    }
    else {
        $false
    }
}

# Función para renombrar archivos PDB
function Rename-PDB {
    param (
        [string]$binDir,
        [string]$libFullName
    )

    $maxFiles = 256

    # Limpiar los archivos PDB antiguos si es posible
    $oldPDBs = Get-ChildItem -Path $binDir -Filter "$libFullName*.pdb" | Sort-Object LastWriteTime | Select-Object -SkipLast 1
    foreach ($oldPDB in $oldPDBs) {
        try {
            Remove-Item -Path $oldPDB.FullName -ErrorAction SilentlyContinue
        }
        catch {
            # Ignorar errores y continuar
        }
    }

    # Buscar un nombre de PDB no bloqueado
    $pdbName = ""
    for ($s = 0; $s -lt $maxFiles; $s++) {
        $pdbName = "{0}_{1}.pdb" -f $libFullName, $s
        if (-not (Test-FileLocked (Join-Path -Path $binDir -ChildPath $pdbName))) {
            break
        }
    }

    # Asignar explícitamente el nombre del PDB
    return $pdbName
}

# Llamar a la función de renombrar
$newPDBName = Rename-PDB -binDir $fullBinDir -libFullName $libFullName

# Renombrar el archivo PDB
Rename-Item -Path (Join-Path -Path $fullBinDir -ChildPath "$libFullName.pdb") -Destination (Join-Path -Path $fullBinDir -ChildPath "$newPDBName")

# Mostrar el nuevo nombre (puedes eliminar esta línea si no es necesaria)
Write-Host "Nuevo nombre del archivo PDB: $newPDBName"

@kone9
Copy link
Author

kone9 commented Dec 11, 2023

For now in Visual Studio I will open the editor with CTRL + F5 without a debugger, at least this way I can start the editor and although I can't debug, I will be able to compile and reload while the editor is running.

IF I want to debug, for now I will have to confirm myself only in game mode.

But hey, at least it works within visual studio without scons..
I'm going to leave this here for the moment, in the future possibly if it motivates me I'll continue.
I hope that someone based on all this information is encouraged and has time to continue since the hot reload is much faster to compile within visual studio.

@kone9
Copy link
Author

kone9 commented Dec 14, 2023

include with relative paths

Captura de pantalla 2023-12-14 123726

Captura de pantalla 2023-12-14 123745

@kone9
Copy link
Author

kone9 commented Dec 14, 2023

Captura de pantalla 2023-12-14 133259

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

No branches or pull requests

6 participants