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

Temp.exe not being deleted after run with c++/g++ #164

Closed
ghost opened this issue Aug 20, 2017 · 11 comments
Closed

Temp.exe not being deleted after run with c++/g++ #164

ghost opened this issue Aug 20, 2017 · 11 comments

Comments

@ghost
Copy link

ghost commented Aug 20, 2017

I'm using code runner to compile some c++ snippets using g++, every time I run my code I get a temp.exe file that was created to run that little bit, however, they're not getting deleted after use so now my project folder has x-number of temp.exe files inside of it until I delete them.

@ghost ghost changed the title Temp exe not being deleted after run Temp.exe not being deleted after run with c++/g++ Aug 20, 2017
@formulahendry
Copy link
Owner

Just want to confirm, you are selecting part of C++ code to run, then I will get a lot of temp******.cpp file?

@ghost
Copy link
Author

ghost commented Aug 20, 2017

That is correct, attached is a gyzao link of my project file

https://gyazo.com/4ef4ee6b7af0f3123cf2dd948d0d8649

@formulahendry
Copy link
Owner

Currently, it will only delete the temporary cpp file. For most language, it is enough. But for complied languages, it also has the binary output. It is not such easy to handle the binary. E.g. On Windows, it would be tempxyx.exe, while it is tempxyx on Linux/macOS. Ans also, not sure all the naming pattern will be the same.
A quick turnaround would be to make the file name not random, something like tempCodeRunnerFile.exe. In that case, there will only be at most on extra file. Do you think it is ok for you?

@ghost
Copy link
Author

ghost commented Aug 20, 2017

Actually that would be amazing, I would rather have 1 extra file in there than coming back to 50 when trying to get one code snippet just right XD

@formulahendry
Copy link
Owner

Hi @computerwiz160 , this has been improved as a fixed name, please install the latest version and have a try.

@ghost
Copy link
Author

ghost commented Aug 20, 2017

Thank you so much! This is perfect!

@formulahendry
Copy link
Owner

formulahendry commented Aug 20, 2017

BTW, just for curious, previously I think only script language like JS, Python would run code snippet. For C++, how do you use g++ to run code snippet? It would be helpful to me to understand how user uses the Code Runner and could help me improve it. 😄

@ghost
Copy link
Author

ghost commented Aug 20, 2017

I actually use code runner as my main compiling tool for c++ in VSCode. I know it was only made to run little snippets here and there, but it's actually a lot more convenient to just highlight all my code and run it directly from VSCode itself, no terminal involved. If I have something that takes a user input I'll use the terminal, but for a lot of my school projects I don't need user input so its very convenient. Code runner uses g++ as default for it, so like I said I just highlight it all and press run.

@formulahendry
Copy link
Owner

formulahendry commented Aug 20, 2017

Since C++ is a little different with script language like JS, Python. It always need a main function. So you always put your code snippet in main function, select them and run? Not sure the difference of running the code snippet and running the whole file.
Something like below, you always need to run the whole file. Could you share a piece of code or screenshot of how you select the code snippet?

#include <iostream>
using namespace std;

int main() 
{
    print("Hello, World!");
    return 0;
}

void print(string str)
{
    cout << str;
}

@ghost
Copy link
Author

ghost commented Aug 20, 2017

So heres an example of a project I was doing last year, what I usually do is have my main window open and then have my "test" window open. In this case, I was testing my isVowel function. So what I did was copy just that function into my test file, ran it, and then continued.

screen shot 2017-08-20 at 2 42 25 pm

@formulahendry
Copy link
Owner

Got it. I guess the purpose of running whole code snippet is you don't want to have an extra CTRL+S to save file before running code, right? If it is, you could go to File->Preference->Settings to set config as below:

"code-runner.saveFileBeforeRun": true

After that, you do not need to select all the code to run.

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

No branches or pull requests

1 participant