-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
setting up pre build events in vs code? #1683
Comments
@miaotian You can set environment variables with the |
I am actually loading tons of environment variables used in 3rd party library. So it is unrealistic to add variables one by one. Is it possible to debug the code I built custom tasks (I am doing c++ and want to use gdb in linux)? Thank you very much. |
I created a task running the command to load environmental variables, and I adds the task as preLaunchTask attributes in the launch.json for debugging. When I start debugging, the tasks runs without problem, but the main problem shows the environmental variables are not loaded. So scripts for my tasks.json: { The scripts for my launch.json: |
@miaotian Sorry for the delay. One solution is to write your own script that setups the necessary environment variables and then at the end calls GDB. In your launch.json you will want MIDebuggerPath to point to that script. Make sure that your script takes in the command line arguments and passes all of it to GDB. This is what you want to add to your launch.json.
|
Great. It works now. Thank you very much. @WardenGnaw I initially tried to initiate in the .bashrc script. It works also, but kinds of cheating. Glad the issue is closed. |
Hi,
I am trying to run some commands to load some library and environment variables before debugging. Is there anyway I can add pre build events like visual studio?
Thank yo very much.
The text was updated successfully, but these errors were encountered: