Sekaus
Sekaus

Reputation: 21

How to fix scons "Cannot create a file when that file already exists" error?

I was about to build a Godot extension that I made in C++. It was going fine with the building of the godot-cpp library, but I got an error when I tried to build the plugin (with my code) by running the command scons in cmd. I then tried to delete the godot-cpp bindings and after that recompile them, but I could not recompile them, and I got the same error as before.

Here is what the error log looks like:

PS C:\Users\****\OneDrive\Skrivebord\gdDynamicMesh\godot-cpp> scons target=template_debug platform=windows
scons: Reading SConscript files ...
Auto-detected 32 CPU cores available for build parallelism. Using 31 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform windows
scons: done reading SConscript files.
scons: Building targets ...
Generating gen\include\godot_cpp\core\ext_wrappers.gen.inc ...
scons: *** [gen\include\godot_cpp\core\ext_wrappers.gen.inc] C:\Users\\OneDrive\Skrivebord\gdDynamicMesh\godot-cpp\gen: Cannot create a file when that file already exists
scons: building terminated because of errors.

I then tried adding --debug=stacktrace to the command but got this error log instead:

PS C:\Users\****\OneDrive\Skrivebord\gdDynamicMesh\godot-cpp> scons target=template_debug platform=windows --debug=stacktrace
scons: Reading SConscript files ...
Auto-detected 32 CPU cores available for build parallelism. Using 31 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform windows
scons: done reading SConscript files.
scons: Building targets ...
Generating gen\include\godot_cpp\core\ext_wrappers.gen.inc ...
scons: *** [gen\include\godot_cpp\core\ext_wrappers.gen.inc] C:\Users\chris\OneDrive\Skrivebord\gdDynamicMesh\godot-cpp\gen: En fil, som allerede findes, kan ikke oprettes
scons: internal stack trace:
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Taskmaster\Job.py", line 737, in _work
    task.execute()
    ~~~~~~~~~~~~^^
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Script\Main.py", line 223, in execute
    SCons.Taskmaster.OutOfDateTask.execute(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Taskmaster\__init__.py", line 246, in execute
    self.targets[0].build()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Node\__init__.py", line 757, in build
    self.get_executor()(self, **kw)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Executor.py", line 386, in __call__
    return _do_execute_map[self._do_execute](self, target, kw)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python313\site-packages\SCons\Executor.py", line 122, in execute_action_list
    raise status    # TODO pylint E0702: raising int not allowed
    ^^^^^^^^^^^^
scons: building terminated because of errors.

Upvotes: 1

Views: 119

Answers (1)

Sekaus
Sekaus

Reputation: 21

I have fixed it now... all I needed to do was to reinstall godot-cpp.

Upvotes: 0

Related Questions