Visual Studio unmanaged C++ smart file explorer - c++

I use Visual Studio to develop unmanaged C++ apps for a living.
Is there an add-on tool (price isnt the issue) that is smart enough to detect folders that I create within my solution folder and add them to the include path (/I)? It would automatically do this for win32, or x64 platform settings, or debug, and release, etc.
It should also be smart enough to remove the include paths if folder is deleted
Arent you frustrated sometimes when you double click a file under solution explorer and Visual Studio says it cant find the file because somebody moved or renamed it? ---> Is there a tool that would periodically scan the files in Solution Explorer and automatically removes or prompts the user to let them know those files are no longer valid?
Like John Lakos once said, I too would pay for an add-on that can automatically add #include into my code by just parsing my project's .h/.cpp files.
When is Visual Studio going to have an Eclipse-like solution explorer that allows user to directly manipuate the files/folders structure directly from within Visual Studio?

You can manipulate files/folders from the IDE! Just click the "show all files" button in the solution explorer (2nd from left, at the top). I just recently found that out.

Related

I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project?

https://github.com/gladosconn/ecdsa_cxxI have been trying to get this library into my project (C++ using Visual Studio 2022, in Windows) because I need to use the ecdsa signature algorithm, I have copied all the files in src folder to a folder called "ecdsa" in the src folder inside my project, and I didn't do anything with the test folders (I think that I don't need them since they're just tests), but then there are these files (.ytml) ,(.txt) ,(.py), I have no idea what am I supposed to do with them or where to put them, but I sure I need them because the program isn't working, it's giving me this error Cannot open include file: 'secp256k1.h': No such file or directory Libraries.Also I have done everything in the requirements section, my compiler supports C++11, and I have installed openssl, and I have CMake installed.This is my first time using anything from Github so I'm sure what to do.
In Visual Studio, right-click on your project in the Solution Explorer pane. From the menu that pops up, choose the 'Properties' item. It is usually at the very bottom. A dialog box will appear.
In the left pane of the dialog box, expand the options Configuration Properties > C++ > General. Now, in the right pane of the dialog box, probably at or near the top will be an item labeled 'Additional Include Directories`. Add the full path to the folder where you copied the source files from GitHub.
You may need to explicitly add ALL the files you downloaded from GitHub into your Visual Studio project.
Try compiling again.

Add Image to Assets Folder UWP C++

Why can't I add images to my UWP assets folder? I usually use C#, but I have to use C++ because I'll eventually be turning this into an optional package (somebody tell me if I'm wrong, and I can write optional packages in C#).
Using Visual Studio, I right click on the Assets folder in the Solutions Explorer click Add->Existing Item and then click on my image. It shows up in Visual Studio, but it doesn't actually get added to the Assets folder so I'm unable to view it when I load my app. I wouldn't think that it matters whether I use C++ or C#, but one is working and not the other.
I've tried rebuilding the project, rebooting the computer, repairing Visual Studio and I'm still stuck.
As suggested by paxbun, I tried using File Explorer to add the file. If I added the file in the Assets folder with the project files, it didn't help. I was able to get the code to work by adding the file to the AppX folder in the Debug folder, but this won't help when I'm ready to release (to make sure, I did a quick sideload).
I haven't put much at all in the code, but you can view it at https://github.com/benjasperson/SimpleCPPImage
Upon further research, I found my answer here.
Clicking "Show all files" in the Solution Explorer and then setting "Include in project" to true was all I needed to do.

Create MS Visual C++ DLL project out of existing sources

My goal is to compile existing C++ classes (legacy code, stored in a set of *.h files) into a DLL so that it can be further integrated into a C# application.
For that purpose, it seems best to use MS Visual Studio. I have no experience with this environment, so I tried the naive approach found on MSDN and other SO answers:
File | New | Project from existing code
selected Visual C++
selected file location that is base for include references used in those .h files
specified a project name
let the wizard find and add all C++ files below the directory
selected "Use Visual Studio" for build, with project type "Dynamically Linked Library (DLL) project"
checked none of the checkboxes below (ATL, MFC, CLR)
specified . dir in the "Include search paths (/I)" in Debug settings
checked "Same as Debug configuration" in "Release settings"
clicked Finish button
This creates couple of VS files in the directory:
mylibrary.sln
mylibrary.vcxproj
mylibrary.vcxproj.filters
mylibrary.vcxproj.user
With a project created this way, I press F6 or select Build | Rebuild solution from the menu.
Then I expect the build to produce the .dll file somewhere, but it does not appear. Only these files appear:
.vs/mylibrary/v15/.suo
.vs/mylibrary/v15/Browse.VC.db
.vs/mylibrary/v15/Browse.VC.opendb
.vs/mylibrary/v15/ipch/AutoPCH/efad7c74cd39331b/EXAMPLE.ipch
Debug/mylibrary.log
Debug/mylibrary.tlog/mylibrary.lastbuildstate
Next, I decided to try creating a fresh new library project, just to observe the differences to get some hints, but that did not help - there were too many differences, even in the file structure...
My questions are:
is my choice of MS Visual C++ a good one for given purpose?
if so, what am I doing wrong here?
I think your steps are probably correct and I think that the right approach to use the code from a C# application. You definitely can call a C++ library from C# by importing the methods.
You missed only to export the methods that you want to use from your library. try using __declspec(dllexport) with these methods. please check this link:
https://msdn.microsoft.com/en-us/library/a90k134d.aspx.
Also, the output should be at the build folder, not the source code folder
Compiling .h files into libraries is ok, the compiler does not care - however, the UI does.
Still, you can tweak this by directly editing the .vcxproj file.
While doing so, make sure that the <ClCompile> sections contain:
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Note that you can use commandline for building the DLL project:
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" -target:Clean,Build
(this assumes that your current directory is the one with your .vcxproj)

Move files in Visual Studio and AnkhSVN simultaneously

I'm reorganizing my project in visual studio. I have some .cpp/.h files which I want to move into a subdirectory physically. A would like to have the following acts simultaneously:
File moving on file system
SVN working copy database updating (with keeping history)
Visual Studio project file(s) updating
Extra benefits would be nice, like:
Updating of #include directives referring to the file.
Are there any solutions? Best workarounds?
This is the proverbial chicken-and-egg dilemma for software developers:
Do you move/rename your files in Visual Studio first then go back to Windows Explorer and correct all the adds/deletes that should really be renames/moves?
Or do you rename/move your files in Windows Explorer then go clean up all the introduced compilation errors in Visual Studio?
You already have the solution at hand! Without AnkhSVN if you do your file operations in Visual Studio you already get two of your requirements: updating your VS project and file system synchronization. With AnkhSVN installed, though, you also get your 3rd requirement: it makes the necessary SVN synchronizations as well. All you have left to do is a commit.
I found the following description from a cached page in a Google search:
In Windows Explorer, right-click and drag the file from its old
location to its new location, then select "SVN move versioned item"
from the context menu. This will not only move the actual file itself,
but it will also make sure that all the file history stays with it
after you check in your changes. Back in Visual Studio, use the
Solution Explorer in VS2010 to "exclude from project" the
(now-missing) copy of the file in its old location, and then "include
in project" the file in its new location. You may need to refresh the
view in solution explorer and/or make sure you are viewing all the
files by clicking the "Show all Files" icon at the top (next to the
refresh icon) in order to see these files.
After you update the namespace to reflect the new location, I
recommend using a global find and replace before you try to compile to
save yourself a lot of trouble.
Hope this helps.

VS2010 Solution under TFS 2010 source control cotaining a C++ project gives warning when opened

I have just taken over the maintenance of a project. It is a VS2010 solution which in amongst its projects includes a C++ project. The whole solution is kept in TFS 2010 as a source control system.
Now whenever I open the solution VS2010 presents me with this annoying dialog;
Visual C++ found a suitable location to store its browsing database and IntelliSense files
for the solution
"C:\***\****x.sln."
Visual C++ examined the folder "C:\***\A***LL."
This folder is not suitable because of the following:
The browsing database in this directory has the read-only attribute and cannot be written to.
The directory is on a local drive.
Because a 'Fallback Location' was not specified in the C++ Advanced Options, Visual C++ is
attempting to use your temporary directory.
Visual C++ examined the folder "C:\Users\***\AppData\Local\Temp\VC++\c****-57e7d5e2." This folder is suitable because of the following:
The directory is on a local drive.
The 'Fallback Location' is configurable under C++ Advanced Options.
Press OK to use this location.
It looks like this is caused by the C++ solutions *.SDF file being under source control, meaning when the solution is opened (despite being under source control) its read only hence the read only bit of the dialog.
So my question is whats the best practice for a C++ project under TFS source control?
Should I remove the .sdf file from source control, leaving VS to recreate this everytime somone gets the solution?
Should I tick the use fallback option efectivly bypassing the .SDF in the repository
or
Is there a better way that lets VS2010 know the SDF file is under source control so it can automatically check it out when it opens the project?
I can only recommend to exclude the sdf from source control. You have no benefit from versioning it, since it's generated every time something changes, which will be almost everytime. As an mantra one could say, that you should never versioning binary files unless it's absolutely necessary to share them (eg. icons and images that are needed).
My issue was with an Unreal Engine 4 solution. The issue was that I had moved the project's intermediate folder (which included build files), and then it was re-generated (without build files) the next time the editor was opened. The fix was to delete the new intermediate folder and re-migrate the old folder to the project directory.
If you had already deleted the intermediate folder and don't have a backup, the fix is most likely to rmb the .uproject>generate visual studio project files.