formulahendry / formulahendry/vscode-code-runner

[Bug] Error when compiling and running files with certain names in Windows

Open
#1,221 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: 1.99.3
- OS Version: Windows 10
- Code Runner Version: 0.12.2

**Describe the bug**
On Windows, when trying to compile and run a C (and/or CPP) file with a name a like `example1.1.c` it fails to run it. The name of compiled file will be `example1.1` (without exe), so when trying to execute, Windows will not recognize the file as an executable. To make code-runner work, I need to change the executorMap for C (and/or CPP) files from

`"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",`

to

`"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe",`

**To Reproduce**
1. Create a new C file name `example1.1.c` and try to use code-runner to compile and run it.

**Actual behavior**
Windows does not recognize the compiled file as an executable, due to abssence of the .exe extension

**Expected behavior**
To generate the compiled file name with the .exe extension in Windows, regardless of its name, so Windows can run it.

**Screenshots**
![Image](https://github.com/user-attachments/assets/d7297095-daba-42ef-b64b-bdf5ec8512d3)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.