VS 2012 change DEFAULT debugging 'Working Directory' - c++

Changing the working directory inside the debugging project options dialog results in an entry added to the "Project User Options File". This file is not 'checked in' to our source control repository because it is supposed to be user specific. I need to change the default setting for the Debugging Working Directory option so users who check out this project don't have to continually change it before they can launch the debugger.
I had thought that moving that generated setting entry from the 'Project User Options File' to the 'Project File' would be sufficient. It does work - as in the default working directory changes - BUT then I can no longer debug the project from inside VS. When trying to run the debugger, all I get is a dialog box saying that VS is unable to start the debugger. (Looking at the debugging settings they seem fine and unchanged).
So what is the correct way to set a default debugging working directory for a VS project?
NOTE: The dialog box only appears if you 'MOVE' the setting entry from the User Options File to the Project File. If you just copy the entry - so that it is in both files - there is no problems running the debugger. Unfortunately this means, again, the user still has to add the setting manually.

I would create a post checkout script to manually add this line to the file.
if the file is not stored you can't go away of manually editing it before usage.
How many times the users are checking out your project? think about the amount of time you will spend on this activity versus the actual usage of it

Related

Remove file from Dev C++ project

I want to remove some files from the project and the project browser.
I can exclude the files in Project->Project Options->Files by selecting the file and unchecking boxes ("Include in compilation" and "Include in linking").
That works for compiling, but I'd rather not see the files cluttering up the browser. How can I actually remove them from the project?
I tried deleting them from the project folder, then compiling, hoping I'd get a prompt asking me if I want to remove the files, but instead I got an error message.
I've right- and left-clicked (both single and double) every symbol in the project browser. The menu that comes up doesn't have a "delete" or "remove" option. I've checked every section and tab under Project.
I looked through the Dev C++ manual, and GCC documentation. I must have missed it. It must be possible to remove a file.
What am I missing?
Project->Remove From Project

How to disable VSCode's Explorer opening directory of opened file?

I'm using VSCode (1.47.3) on Ubuntu Bionic with the MS Python Extension Pack. I really want to disable the feature whereby Explorer decides to open the parent folder of the file I have just opened and allow me the control to open this folder manually (if I want to, which I rarely do).
Scenario:
I have some app-specific .py files open and Explorer shows my app's folder: "app" - all good.
I navigate to a DJango dependency e.g. models.Manager when suddenly Explorer automatically shows the folder: site-packages/django/db/models - which I don't to happen. I didn't ask it to happen.
In order to go back to the context of my top-level "app" folder, I have to scroll 100km back to where I was! I just want Explorer to stay in my "app" directory, regardless of what other files I may open.
I only opened the DJango dependency for context/reference. I have no intention of editing that file (obviously) so I don't need any other DJango context. If I want to open a parent directory of a random file I've opened, I'll do that myself.
How can I disable VSCode from doing this? Is there some JSON config I can modify?
So I Googled this again and within minutes found an answer that I swear I had never come across before.
The setting I was after was:
"explorer.autoReveal": false
Described very well in the following issue from 2016: https://github.com/Microsoft/vscode/issues/14745

How to disable creating .sbr and .bsc in Visual Studio C++ Project?

I have Below Settings, but my project still creates .sbr and .bsc file.
What could be the reason?
How can I disable creating those files?
As there are several ways of enabling the feature, more awkward ones need to be checked also:
Enable Browse Information may be set in another configuration
By default it's (was) only set in Debug but I've seen some projects setting in Release also
The Configuration selector is in the property pages, above the part in the (question's) screenshot
One may wish to run through available configurations (to find the potential guilty) and then use the All Configurations to set all at once
Additional Options can be appended to the ones configurable in the GUI
Check Configuration Properties, C/C++, Command Line, Additional Options for compiler options /FR or /Fr
Your project may be creating the browse information in a custom action
Check Build Events for custom cl or bscmake commands
If you did all of what Helder Magalhães wrote and VS still creates .sbr and .bsc files then you have to check all source files in the project, because they can have that setting for them individually (as I found out):
Open each source file's Property Pages dialog box.
Click the C/C++ folder.
Click the Browse Information property page.
Modify the Browse Information File
or Disable Browse Information property.
Today I learned my lesson on VS
... each cpp file has his own properties in the project file.
... and its possible to configure the project to no browseinformation and enable the option at file-level
Solution for my BSCMAKE error was to disable the option in the project (already done) AND to set the option for each cpp file in the project to "no" .. could be done manually or with search and replace in the vcxproj file.
I'll post this solution here even though this post is old, as it's not mentioned in the post.
I found that once you enable the .bsc file generation, it's on forever. Even setting it to false doesn't stop its generation. If you have the following line in your .vcxproj file:
<BrowseInformation>false</BrowseInformation>
Then the file is still generated! The only way to stop it is to manually edit your .vcxproj file and delete this line (which is quite safe to do).
It worked for me; perhaps someone else Googling this problem will find this helpful.

Unnecessary project rebuilds when unit testing in Visual Studio

I know about this question (and answers), but despite trying all the suggested options I am still stuck.
I have a solution with multiple projects, but for this particular case let's say I've got my ExampleProjectA and a corresponding unit test project ExampleProjectATest. The first one is added as a reference to the test project - not via Visual Studio's "Project References" but as a link to the DLL (something like "..\Path\$(Config)\ExampleProjectA.dll") - this is due to build server requirements in our company, but the problem also existed when we still had "Project References".
Building and then running a single unit test works fine
Changing just a single letter in a unit test and then letting the test run always results in a rebuild of ExampleProjectA, even though this shouldn't be necessary
Setting all (there were only a few) files in ExampleProjectA from "Copy always" to "Copy if newer" in their respective properties didn't help
Checking the checkbox under Tools => Options => Projects and Solutions => Build an Run (see below) also didn't change anything
To see if there was any more information available, I changed the build output settings to diagnostic. Each time a rebuild of ExampleProjectA is triggered, the first line in the output windows is
1>Project 'ExampleProjectATest' is not up to date. Input file 'c:\tfs\mysolution-dev\exampleprojectatest\myfolder\namegeneratortest.cs' is modified after output file 'C:\tfs\mysolution-dev\exampleprojectatest\bin\Release\exampleprojectatest.pdb'.
The class name written to the window (e.g. namegeneratortest.cs) changes according to which test file I change.
Not sure why this message comes up, but the next step was to disable the debugging information as shown below under Project properties => Build => Advanced => Output => Debug Info => None:
Still the same, nothing's changed.
Another thing I tried was to check the timestamps of the files contained in my solution folder (as there was a case where a user had a file with a future timestamp - see linked post) - to no avail.
Last thing I tried was to change the build settings in the Configuration Manager to a different target platform - some settings wouldn't let me build the solution successfully, some other settings did, but the problem described persisted, so no change.
The behaviour is similar (not the same though) with both the Visual Studio Test Runner and the one provided by ReSharper.
Visual Studio Test Runner
Project 'ExampleProject' is not up to date. Input file 'C:\tfs\mysolution-dev\exampleprojecta\Views\Shared\someview.cshtml' is modified after output file 'C:\tfs\mysolution-dev\exampleprojecta\bin\exampleprojecta.pdb'.
ReSharper Test Runner
Project 'ExampleProjectATest' is not up to date. Input file 'c:\tfs\mysolution-dev\exampleprojectatest\myfolder\namegeneratortest.cs' is modified after output file 'C:\tfs\mysolution-dev\exampleprojectatest\bin\Release\exampleprojectatest.pdb'.
I'm using Visual Studio 2013 Premium Edition with ReSharper 8.2 and the latest updates, the projects in our solution file are in C#.
Update
To clarify - the first line in the output window does show that the test project has to be rebuilt - this is fine. The following lines, however, indicate that also ExampleProjectA has to be rebuilt, which shouldn't be necessary. Subsequent messages to the output window also show that other projects (referenced from ExampleProjectA have to be rebuilt.
Update 2
Despite installing Update 4, nothing has changed.
For my case the solution was to change the build action of a config file from "Copy always" to "Copy if newer". It took a while to find as I had to change the build output details to get the details about which file was causing the error, e.g.
Project 'xyz' is not up to date. Project item 'c:\my\path\web.config.dev' has 'Copy to Output Directory' attribute set to 'Copy always'.
From my experience it can also happen that different file names are shown when building multiple times, so make sure you have the right one and / or build again if the problem persists.
Also have a look at this question and its answers to find some more information.
I have worked around this problem by deleting the .pdb file in the \obj folder. It seems that visual studio is checking file modification time to decide if it should build or not the project (in your case ExampleProjectA) and the .cshtml is newer than the pdb. But when launching the build, project changes in .cshtml files are not triggering the .pdb rebuild, so the problem remains.
By deleting the .pdb in \obj folder (not in \bin as the file there is copied from \obj and would keep the old modification time) the modification time for the .pdb is newer than the .cshtml and the VS doesn't need to build the project before running the tests. Of course this only works until the next time you modify a .cshtml file, that's why I qualify it as just a workaround.
Check what version of Visual Studio 2013 you are using. Update 1 has a pretty big issue where it rebuilds everything. See: https://connect.microsoft.com/VisualStudio/feedback/details/811112/unnecessary-solution-rebuild-on-each-test-run
Upgrading to Update 3 did the trick!
I'm not sure if Resharper could affect things as well. I suggest temporarily uninstalling it.

The program file specified in the launch configuration does not exist

I am facing some problems regarding eclipse for c/c++. I am trying to create a new project, I provide the code, and after running the code I get this error:
The program file specified in the launch configuration does not exist
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
Please notice that I am working with spice toolkit; I set the path for the "include" files and the libraries, but still I can not have a result.
What causes this error and how can I resolve it?
Right click on your project --> Properties
Run/Debug settings
Delete whatever is set as "launch configuration for '........'
Project --> Clean
Project --> Build Project
You can create a run configuration. Go to Run > Run Configurations. Click New button, fill C/C++ Application field, i.e., insert path to your executable. The new configuration will appear in the list which appears when you click to the arrow next to run button.
Of course this assumes your can build without problems, otherwise you won't see an executable to point to.
You can clean the project, build it again and run it as a local C/C++ application. Simplified steps as follows,
Right click on the project
Clean Project
Again Right click on the project
Build Project
Again Right click on the project
Run As ->
Local C/C++ Application
As the error reads:
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
First of all you need to check whether there is an executable "mm.exe" in your Debug folder. (Of course, it is not there and that is why the error)
Go to Project > Clean
and you should see some files being deleted from your Debug folder
Go to Project > Build Project
and you should see some new files being generated e.g. mm.d, mm.o, mm. This "mm" is probably the executable you're looking for
Now that you know what your executable is, you should tell eclipse what file to execute instead of mm.exe. Go to Project properties and in run debug settings create a new configuration (or edit an existing configuration, if there is one already). In this configuration, in main tab, in C/C++ Application specify a full path to "mm". Which, in your case is - "C:\Users\elisabeth\workspace\mm\Debug\mm"
A better way to do this in eclipse is:
${project_loc}/"your folder"/"your executable file"
e.g.${project_loc}/Debug/mm
what worked for me is file->refresh
then do the Debug configuration again by choosing the right c/c++ binary again.
Avoid troubles with configuration by going into Project properties > C/C++ build > Refresh Policy and specify your project folder. The configuration option "Search project" will show a correct folder then and you will see whatever you build there - Debug, Release or both. You don't want to specify the folder using Browse option every time you import project or switch configurations.
As this is the first SO discussion that appears for this topic on Google and none of the answers solved the problem my students were having, I would like to mention the solution we eventually found from this answer:
Open project properties (Right click on your project, choose Properties on the menu)
C/C++ Build -> Settings
Click on Binary Parsers tab and check PE Windows Parser
Keep clicking Move Up until it is at the top
This had been set to Elf, even though we were using a freshly downloaded Windows version of Eclipse.
sometime missed closing curly brace can be part of a problem. Make sure prototype your function at the beginning of the file. Then right click your project in the left side bar. click clean project. then click build project and finally run project
I encountered similar issues and their related problems a few days ago. Finally, I found out that, just because I had moved my project folder (workspace folder of Eclipse) to another place so Eclipse could not find what its need as usual.
Solution: I just set the workspace to my new place (Hey Eclipse, my workspace now is here) :
Menu "File" -> "Switch workspace" -> "Other..." -> click "Browse..." button and point to new place then click "Select Folder" button and click "Launch" button.
Nice day.