franneck94 / Vscode-C-Cpp-Runner

🚀 Compile, run and debug single or multiple C/C++ files with ease. 🚀
MIT License
53 stars 14 forks source link

Can't build or run single file #85

Closed MC-dusk closed 1 year ago

MC-dusk commented 1 year ago

How to use: Compile a single file 1️⃣ Open the C/C++ file you want to compile (build). 2️⃣ Select either debug or release mode for building the binary (debug is the default case). 3️⃣ To build the binary press ctrl+alt+b. 4️⃣ To run the binary press ctrl+alt+r. 5️⃣ To debug the binary press ctrl+alt+d.

Those three hotkeys don't work for me. Just nothing happened after pressing.

franneck94 commented 1 year ago

Which operating system? Please provide a screenshot of the workspace you have opened

MC-dusk commented 1 year ago

win10 22H2 image

franneck94 commented 1 year ago

Please add a screenshot of the full VSCode window.

Also please send a scrrenshot of the settings.json file

MC-dusk commented 1 year ago

Well, I have deleted previous response posted 10min before because I've found what the problem is. If there is only one c/c++ file in the folder, then everything goes well. If you need more info, please tell me and I'll post more. Thank you.

franneck94 commented 1 year ago

ctrl+alt+b. Should also work if there are multiple files in the same dir, thats the idea behind that keyboard shortcut

MC-dusk commented 1 year ago

To be more precisely, if there are c and cpp files in the same folder, and I try to compile a single c file, the ctrl+alt+b will be invalid. Though ctrl+b is fine and it will only compile cpp files. The second pic means I can't use ctrl+alt+b.


image image image image

franneck94 commented 1 year ago

You cannot have a c++ program without a main that's the issue on that screenshot regardless of the extension

MC-dusk commented 1 year ago

That's just an example, not meaning that I want to compile an empty cpp file. I want to show you that even the cpp file is all commented, the c file can't be compiled. Pic1 I complied the c file successfully. Pic2 I added a cpp file and I can't use hotkey in the c file then. Pic3 I tried to complie the empty cpp file using hotkey, and it responded and then reported an error. Just for testing hotkey. Pic4 I used hotkey to compile the cpp file and succeeded.

franneck94 commented 1 year ago

Okay regarding Pic 2 i have never tested C and C++ files in the same dir

franneck94 commented 1 year ago

Fixed in 4.3.1