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

on c/cpp file, while right click the "run code", errors would occur on windows #41

Closed
lsmale opened this issue Dec 17, 2016 · 6 comments
Labels

Comments

@lsmale
Copy link

lsmale commented Dec 17, 2016

The default "code-runner.executorMap" of "c": "gcc $fullFileName && ./a.out" and "cpp": "g++ $fullFileName && ./a.out", but in pc the default output file name is "a.exe", and exec method should be "a.exe" or "a".

@formulahendry
Copy link
Owner

Thanks @lsmale for reporting it, I will fix it for Windows.

@formulahendry
Copy link
Owner

Hi @lsmale , this issue has been fixed. Please install the latest version and have a try.

@lsmale
Copy link
Author

lsmale commented Dec 21, 2016

Hi @formulahendry , I tried it and I find you used command "cd $dir", and I test it with the file in different drive, it turns out the command cannot cross drive and while in different drive it may result in "g++: error: name.cpp: No such file or directory“.

@formulahendry
Copy link
Owner

formulahendry commented Dec 21, 2016

HI @lsmale , the current working directory would be the root folder that you open in VS Code. Thus, the drive of current working directory should be same as that of the cpp file. So are you opening a file from another drive in VS Code? To Fix this, there are two options, refer to https://github.com/formulahendry/vscode-code-runner#about-cwd-setting-current-working-directory:

  1. Set code-runner.cwd to the drive of cpp file
  2. Set code-runner.fileDirectoryAsCwd as true

@formulahendry
Copy link
Owner

Or, you could replace cd with pushd or cd /d. Refer to http://stackoverflow.com/questions/17753986/how-to-change-directory-in-windows

@lsmale
Copy link
Author

lsmale commented Dec 21, 2016

Hi @formulahendry , I get it! Thanks.

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

2 participants