Hi there I am currently using Codeanywhere as an on-the-fly IDE for C++, to be able to easily code between different devices.
While setting the Codeanywhere environment, I ran into the "Project Config" file (that gear icon beside "Run Project" button), and I havent found nothing on this file's parameters.
I'm wondering if using this I could set compile and run settings (something like Visual Studio Code).
Am I missing an obscure documentation page?
Also could anyone explain those default settings?
Project Config C++ file
{
"run": [{
"default": true,
"devbox": "cpp_test"
}]
}
Thanks!
This is most useful when combined with the undef option in order to suppress warnings for project-specific global variables. Setting an entry to true enables reading and writing to that variable. Setting it to false will trigger JSHint to consider that variable read-only.
Related
I am using VSCode to debug a C++ project configured and built using CMake tools (extension in VScode).
I have to use below command to trigger the execution:
./cbs_ta -i ifile.yaml -o ofile.yaml
As you can see, there are two command line inputs (-i and file name for input file) (-o and file name for output file). I read that using "args" parameter in launch.json, we can pass command line arguments. So I modified "args" in launch.json as follows:
"args": ["-i", "ifile_1.yaml", "-o", "ofile_1.yaml"],
Unfortunately, I am getting error that
the option '--input' is required but missing
I used CMake Tools extension to configure and build the targets.
Please help.
Edit: I have identified that when I click "debug" menu option in CMake in VSCode, the debug session starts but it does not take into consideration launch.json. I identified it since I kept ```"stopAtEntry": true''' but it did not stop at entry point.
It sounds like you have encountered the confusing 'extra' debug button which the CMake Tools extension places on the toolbar. The C/C++ extension's main debugger, configured via 'launch.json', needs to be invoked using the 'debug' view in the left side panel
(as do other debug extensions such as cortex-debug).
Once a debug configuration has been selected, a debug launch button is added to the status bar. This means that users of the CMake Tools extension will then have two different debug buttons on the status bar, which is confusing to say the least. Presumably in part because of this confusion, the CMake Tools extension has options which can be placed in 'settings.json' to remove the buttons it adds to the status bar, either selectively or all together. This is also a useful way to recover quite a bit of status bar real estate, if you don't often need to use things like the toolchain selector.
To remove all buttons added by CMake Tools:
"cmake.statusbar.visibility": "hidden"
And to selectively remove the debug launch button:
"cmake.statusbar.advanced": {
"debug": {
"visibility": "hidden"
}
}
I would expect most users to prefer the selective option, as things like the build target selector are fairly essential to most use cases.
The underlying issue here is that for some reason the CMake Tools extension does not use the standard extension point for debugging functionality, but instead just places an extra button on the status bar to invoke debugging directly without a configuration entry in 'launch.json'. The CMake Tools extension docs describe this as a 'quick' debug function, which suggests that their reason for this design decision is related to different use cases, although personally I can't really see a clear use case for it. Debugging is by its nature an activity which is highly dependent on configuration, as everything from the choice of actual debug program on down needs to be specified in most cases.
Every now and then my VSCode IDE does not highlight errors in my C++ code anymore. Reloading the window, restarting VSCode or re-installing the extensions does not help.
Example:
void some_func() {
int some_num = 1;
some_nmn++; // should give error, since variablename contains typo. No error indicated.
}
In terms of C++, I am using the extensions only C/C++, however I also use a couple of other extensions that are helpful in the context, like CMake and Code Runner.
Apparently there were two things wrong with my setup: I had the wrong standard and I used the wrong Intellisense Engine.
Change the Intellisense Engine by doing Ctrl + Shift + P -> Preferences: Open Settings (UI) -> Enter C_Cpp: Intelli Sense Engine in the search bar. In the drop-down menu select Default.
After that I got a lot of unnecessary warnings regarding std, e.g. namespace std has no member optional (see post).
I fixed it by changing the standard in my workspace settings. Ctrl + Shift + P -> Open Workspace Settings (JSON). Add this line:
"C_Cpp.default.cppStandard": "c++17"
Be aware that the first setting is global and the second setting is only for your current workspace.
Something else must be wrong in your settings, or maybe some conflict.
Now as you uninstall VS Code it's possible that these settings are not erased, you can check the folders where the settings are kept and delete the them if necessary, the default locations for the settings are:
For Windows:
%APPDATA%\Code\User\settings.json
For macOS:
$HOME/Library/Application Support/Code/User/settings.json
For Linux:
$HOME/.config/Code/User/settings.json
I should add a global include path to my system (i.e. it's Google Test so I need to include "C:\gtest\include")
I appended it to the PATH environment variable and restarted VS2013. However, VS2013 still complains about the missing .h files.
What's wrong with this IDE?!?
First, you definitely don't want the PATH environment variable. You do want the INCLUDE environment variable.
Second, use a statement like SET INCLUDE=C:\gtest\include;%INCLUDE% to set it.
Third, that's only going to work in a command window that you're running command line builds in.
Fourth, so try setting it on your machine using This PC's properties "Advanced System Settings" Environment Variables dialog. Remember to restart your VS2013 after setting it so it picks up the new env vars.
Fifth, why not do a SET (with no arguments) after you've set your non-working INCLUDE variable and paste the result into your question so we can all see what your environment variables look like - then we might be able to help you better.
Sixth, it's going to end up being your misunderstanding of how things work. That's clear since you think the PATH env var has something to do with VC++ searching for include files. So why the gratuitous "What's wrong with this IDE?!?" slam? It's not winning you any friends.
Seventh, see the MSDN article Setting the Path and Environment Variables for Command-Line Builds for tips. It came right up when I googled for "visual studio include environment variable", and it has help for you.
I am unable to change my PATH environment variable from Microsoft Visual C++ 2010 Express using a project relative path.
Relevant paths:
Solution path: D:\School\dva303\project\Woods\
Project path: D:\School\dva303\project\Woods\Woods\
Absolute path to needed DLL directory: D:\School\dva303\project\Woods\Woods\allegro-5.0.10-msvc-11.0\bin
When I use the absolute path:
Project Properties / Debugging / Environment: PATH=D:\School\dva303\project\Woods\Woods\allegro-5.0.10-msvc-11.0\bin
It works! But if I change it to a project relative one using $(ProjectDir):
Project Properties / Debugging / Environment: PATH=$(ProjectDir)\allegro-5.0.10-msvc-11.0\bin
It fails and I get a message that the DLL can not be found on my computer. It does not matter if I use a \ after $(ProjectDir) or not.
Questions:
How do I get it to work?
How do you debug situations like this one when a Visual Studio environment variable is not behaving as you expect it to? Is there a way to print it out or by some other method see what it will be evaluated to?
You can simply add a post build task to echo out $(var), and you'll see it in the output window.
I think your actual problem is that your environment variables don't propagate to the application you run/debug. You can use SysInternals' Process Explorer to check this. If so, just add another post build task to copy the required DLL files to the same directory as your output.
If you just want to see the values of $(ProjectDir) then if you go in to your vcxproj properties, then anything then lets you get to the "macros" view. Such as adding a new include path will list these out and their values. But you'll still need the echo trick for anything "dynamic" or to check nothing is overriding it.
I have combined several projects into one solution. I created empty solution and added these projects and here is a blue print of how it looks like:
Root:
Project1 - directory
Project2 - directory
Debug - directory
Main.sln - file
Now I want to direct the executable and dll from both projects to \debug folder shown up of the solution file. I go into project properites >> Configuration Properities >> General >> 'Output Directory' and change the output directory to $(SolutionDir)$(Configuration)\ which is default for a new project.
The problem is that it has no effect on where the output file is created, it is still created in the old destination. The old path for `Output Directory' was .\Debug\ not that it matters.
Could this be because the SolutionDir & Configuration may not be defined? Where can I see their definition or values? I also want to create a new configuration which would be 'Release with Debug' how can I create that using environment variable? Thanks!
My project is MFC/Visual C++.
Add-on:
Where are these identifiers like SolutionDir defined in the scrip? I look up for in .vcxproj file but there is mention of it. I create a new dummy VS2010 project just to look at it's .vcxproj file but these project settings identified are not defined in any place that I can see!
This is most likely caused by specific settings overriding global settings, namely Linker's "output" setting. This happens often as a result of conversion from earlier Visual Studio.
What you need is to go through every setting, paying attention to those whose values are written in bold, and reset to default (select it from dropdown) every setting with 'debug' or 'release', and others as necessary.
There could also be specific settings on files. I usually resolve this by opening project in notepad and removing any excessive settings. Just be careful. Using multiline replace in Notepad++ or any other capable editor helps.
I think I had a similar problem.
What I ended up doing was editing the vcxproj file directly. Find this section and edit it like this for each of your configurations:
<PropertyGroup>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
</PropertyGroup>
I had a similar problem with the Intermediate Directory setting in one of my VS2010 projects. No matter what I set it to, it would always use the default value of $(SolutionDir)$Configuration. Oddly, other projects in the same solution with the same settings worked just fine.
After playing around, I stumbled upon a solution.
Click on the setting in the propery page dialog.
Click on the down arrow button in the right-hand side of the edit box.
Select "inherit from parent or project defaults".
Click "Apply".
Click on the setting and change it to your desired value.
I don't know why this works, but it does. It seems like the macros were not being properly evaluated for whatever reason. Then, after you apply the inherited values, it seems to reset itself and start evaluating the macros properly.