In a Visual Studio 2013 C/C++ project, adding a folder in the Solution Explorer does not physically create a folder under my project path (on the hard disk). This way I can keep my project structure (in the solution explorer) separate from my folder structure (actual folders and files on the disk).
C# projects seem not to like this idea. In a C# project whenever I add a folder, the IDE tries to create it on the disk. Is there a way to stop this? Can I tell the IDE to use C/C++ behaviour?
Related
Here is my current setup:
Some C code (some embedded code) in a folder and subfolders. Organised as I needed and how the embedded editor needed.
If I use Eclipse to create a new C project and place the project file in the root of my sourcecode, then Eclipse will find all folders and files, then index them correctly. I then able to browse the files as a project, functions linked to other files, defines are showing up correctly.
Now, our version control is Visual Studio 2019, and I'm looking for a solution or guide, how to open the same file structure in visual Studio instead of Eclipse. I don't want to open the Eclipse project, I try to drop the use of Eclipse, so I can just use one tool to version control the files and browse the code for editing. I also don't want to compile, debug in visual Studio, I can use the dedicated environment for that. I only want to edit the files like it would be in Eclipse, save the files as the VS editor is much better than the embedded editor. (By the way, the embedded studio IAR and it's editor is horrible, hence why I used Eclipse in the past, but I don't want to open IAR project in VS, just a nice editor needed from VS.)
Any suggestions? Anyone done this successfully?
When you open VS2019 directly (i.e. not via a source or project file) you should be presented with a start page that includes this:
Select "Open a local folder" and it will present the project from the root you select. It will even apply IntelliSense for code completion for symbols within the selected code base. For headers external to the project tree, you can add include search paths to get better navigation, browsing and completion.
A more comprehensive integration with IAR is possible using VisualGDB extension as described here.
I am working in a new project in C++ with Qt that is using CMake to generate the solution.
The project is quite big and it's working fine both in Visual Studio 2017 and QtCreator. Most of the people generate the solution for building using Ninja and import the build to QtCreator. But I prefer working with VS IDE.
The problem is that with QtCreator the Solution Explorer is keeping the folder structure, but in VS, all the projects (libs and dlls) hungs up from the solution (root) so I lose some valuable information.
I am quite new in CMake, and I would like to know if there is a way to generate the VS solution with the same folder structure that the source code has without affecting QtCreator solutions.
CMake does support organizing the projects in your Visual Studio Solution Explorer into folders, so you can name the folders to mirror the directory structure on your system. For example, if your projects are organized like this:
Utilities/LibraryA
Utilities/LibraryB
Executables/tools/ParserExecutable
You can use the set_target_properties command with FOLDER to designate the containing folder for each project in the VS Solution Explorer:
Utilities/CMakeLists.txt:
set_target_properties(LibraryA PROPERTIES FOLDER "Utilities")
set_target_properties(LibraryB PROPERTIES FOLDER "Utilities")
Executables/tools/CMakeLists.txt:
set_target_properties(ParserExecutable PROPERTIES FOLDER "Executables/tools")
You can try to automate this by using CMAKE_CURRENT_SOURCE_DIR instead of naming the folder explicitly, but start with a simple case first!
Also, make sure you add this to your top-level CMake to enable VS folders for your projects.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
I have a standalone project that contains some code I'd like to re-used. I created a library project in order to contain that code. There does not appear to be a way to move files from the one project to the other. (cut/paste in solution explorer did not work)
I then manually copied the files in Windows explorer (outside of VS) into the library's main "folder" but they didn't show up in solution explorer either.
Anyone know of a way to do this without having to manually create each file in the library and then copying/pasting the code into the files?
You need to copy the files and paste them into your solution/project folder(s). Once the files physically exist within your solution/project folder structure (Windows FileSystem / Explorer), then you right-click on your project within Visual Studio, select Add then Existing Item. Browse to the location of that file and open it. It will now exist within your project as a code file.
If you have two projects within the same solution, you can simply drag the file from one project to the other within Visual Studio Solution Explorer. That will create a copy of the class in the new project. You can then remove the old one and clean up any code references in the first project.
I am trying to open a existing project in visual studio 2010 using
new->project from existing code
and selecting visual c# as the language. When I run it, I get errors. Later I heard from the person who created the project that I have to add few references, which are present in the references folder in the project itself. It comes in the side window - solution explorer.
However, when I right click on that folder to add as references, that option is 'greyed', or disabled. How Can I correct this?
The DLLs named freeglut.dll and glut32.dll are not COM or NET components. You cannot add them as references to your project (You have 4 solutions in your archive, I have choosen the one named fwa_annimate but I think the problem is the same).
The DLL named Tao.FreeGlut.dll needs these files in the same directory where you application run to work. So the easiest way to resolve your problem is to select the two DLLs inside Visual Studio and change the property Copy to Output Directory from Copy Never to Copy Always.
In this way, when you start to debug your app, the VS IDE will copy the two files to the BIN\DEBUG or BIN\RELEASE directory where you app runs when launched inside the VS IDE.
Of course, you need to deploy all these file when you distribute your application.
(By the way, I have no idea what is supposed to do)
I'm currently using Visual Studio 2010 Professional. In my entire experience with Visual Studio (since version 6), a C++ project structure was always virtual. In other words, when I move files around and create folders in the project, this had no bearing on the actual structure on the filesystem. I've always had to manage the two independently (the filesystem structure and the project structure).
Is there a way to make C++ project structure in Visual Studio act as it does in C#, whereby all move/copy/create folder/etc operations in a C++ project directly affect the corresponding file system hierarchy?
Thanks in advance.
I'm afraid it's not possible, since Visual C++ and Visual C# handle "folders" quite differently.
In Visual C++, folders are more akin to filters, for example a "Source Files" folder might be hinted as a filter to contain .cpp files, while a "Header Files" will contain .h files.
However there's a workaround, described here : Visual Studio projects with multiple folders