Visual Studio 2010, error when including headers from another folder within the same solution space - c++

I am new to Visual Studio 10 c++, I imported a sample project, the project came with multiple folders in the same solution space project, each with files in it, including any of those files in any other file within any of the project worked perfectly then I added another filter to the project, it worked fine but the files in it can not be included in any of the original project files, is there anything am missing out? I followed these instructions when creating the folder
Right Click project
Click Add
Select New Filter
change Filter Name
Right Click Filter
Add
Select Class
And could someone tell me how to make the Filters and file in them visible in explore, the Sample project came with Visible Filters/Folders so there has to be a way of making them visible in explore and VS, here are Images showing what I mean, in the project I have the laneDetector filter which does not exist in project folder
Showing My VS project layout with LaneDetector filter/folder visible
Showing My VS project in explore with no LaneDetector filter/folder

Related

Visual Studio 2019 is having several problems, including loading files

I have been working on a project for a while now (C++), in Visual Studio 2019, but I've suddenly run into several problems that send me in circles between them.
I loaded it one morning, and found that it couldn't load any of the files.
So thinking I must have accidentally moved files or something, I just copied my files again from my Github repository, but then it started having problems with every include file for the headers.
Manager.h is in a different folder in the project, which makes this more confusing to me because if the source files can't open a header file in the same solution, the headers should have problems opening a different header in a different part of the project.
I've tried deleting the project settings and reloading it, but VS won't reload them, and Github desktop is freaking out with any action with the project.
Cloning my repository again and loading that just sends me back to the first problem...
Anyone have any other ideas for what I can do?
Check to see if the files are in the folder present in the error message. If they are that can be a problem with the config files of the project/solution.
Possible solutions:
Since you have the project in the repository, a quick way to solve it would be to delete your local project and clone the repository project. (Or clone it to a different location)
You can try to repace the <Subscriber.h> by "Subscriber.h".
Create a new empty project and add all the project files through the Solution explorer:
right-click on the folder where you want to add the project (I recommend Source for the .cpp and Headers for the .h);
Select Add -> Existing item -> select the files.

Visual Studio 2019, no Intellisense with "Show all files"

I have started learning C++ with Visual Studio 2019 and noticed a strange behaviour. When you create an empty project you are represented with "Filter" files. Now if I active "Show All Files" I can create directories. I created the following structure:
/Core/
/Engine/
Main.cpp
Now if I create a "class" it is, by default, created next to Main.cpp. I would then move the Class.h and Class.cpp into /Core/.
Now if I start editing the newly created files I loose Intellisense. If I uncheck "Show All Files" I get it back. Does anyone else have the same problem?
Another question I wanted to ask was about filter files and project folder structure. Should I use the filter files to organize my project or an actual folder structure? I'm slightly confused because of the Intellisense problem, that's why I'm asking.
And if I should create a folder structure, how should I handle includes like this #include "..\..\... \FileUpInTree.h". In Javascript and Webpack you could define "Alias" Directories to eliminate this. I was wondering if something like this exists for Visual Studio aswell. Maybe namespaces?
Now if I start editing the newly created files I loose Intellisense.
If I uncheck "Show All Files" I get it back. Does anyone else have the
same problem?
I have faced the same issue as you described and when I migrate a file to another folder under the Show All Files filter, Intellisense does not work, which is really strange. When I didn't migrate the file, Intellisense works well at the default address.
And I have reported this issue on our DC Forum and you can add any detailed info on that link and also anyone who is interested in this issue will vote it so that it will make Microsoft attach great importance.
The workaround is that you should uncheck Show All Files and then click it again. After that, Intellisense will turn back and works well.
Another question I wanted to ask was about filter files and project
folder structure. Should I use the filter files to organize my project
or an actual folder structure? I'm slightly confused because of the
Intellisense problem, that's why I'm asking.
Actually, when you use the default project type in c++ projects(not click Show All Files), this structure will automatically identify each file in your project and categorize it into its own filtering folder. At this time, the intellisense works perfectly, because subdividing various files will not conflict.
But in this format, you cannot create folder structure.
Besides, using the filter files or the actual folder structure are the same effect. If you use actual project structure in the Windows Explorer, it will be showed under solution explorer(click Show All Files) automatically.
Suggestion
As long as you do not want to migrate files at will, you can use Intellisense under this filter.
Or
1) create folder structure under Show All Files and then uncheck Show All Files to get Intellisense.
And if I should create a folder structure, how should I handle
includes like this #include "....... \FileUpInTree.h". In Javascript
and Webpack you could define "Alias" Directories to eliminate this. I
was wondering if something like this exists for Visual Studio aswell.
Maybe namespaces?
I think you do not need to worry about this too much.
When you want to use the file under the folder structure of the project, you can just use #include"xxx.h" and the Intellisense will automatically grab the header file in the project.
And if you want to reference a c++ class, you can just use namespace <the c++ class namespace>.

VS2017 renaming projects - the folder already contains an item named

I am reorganizing numerous small solutions/projects into one solution in Visual Studio 2017 but I keep getting error messages like:
The folder already contains an item named 'Staging'
Followed by:
Exception of type 'System.Runtime.InteropServices.COMException' was
thrown
The projects are all in individual folders in a folder called Packages with the project folders named like:
Staging.Finance
Staging.HR
Staging.SharePoint
There is no folder called Staging in the Packages folder and there are no files called Staging in the folder for the project I am trying to rename. The project file name is currently Finance-SSIS which I am trying to rename to Staging.Finance.
There is a project called Staging in my solution but this is in a different folder from these projects.
I can rename the project files outside of Visual Studio but want to understand why I'm getting this error.
Upon searching I came across these three solutions:
Try Restarting Visual Studio.
Open Solution Explorer there is an icon that looks like a many
Pages which is the Show All
Files. Once clicked, one is able to see the hidden, to the visual
studio project, the folder that was causing this error. (Look for
the folder in the View section.). After I deleted the unwanted
folder, and Rebuild Project, You should be able to Create the
controller which will create the view automatically
A project can exist in a solution in only one location. To correct this error:
To show hidden Solution Folders, select the solution or a Solution Folder that contains a hidden Solution Folder and then on the Project menu, select Unhide Folders.
Credits for solution 1 & 2: See original answers
Credits for solution 3: See original post
I suggest to search in main projects file content about 'Staging' . For example take a look at solution file (with .sln extension) content and search about 'Staging', I hope you will find it there!

Visual Studio 2010 Creating Packages/Folders in project

I am new to Visual Studio 2010 C++, I am trying to create packages in my project like we do in Java Eclipse but to my surprise the only option I found available was Creating a Folder so I selected that and created several folders added my classes to them then I tried including my header files in the folders I had created but it keeps giving me an error to hat I cannot locate the file, I checked in the Project directory and the folders are not in there but very visible and editable from Visual studio, I tried manually adding a folder with my classes from windows explore and still could not locate them in VC
The logic is organized slightly different than in Eclipse.
With Visual Studio, you create a solution (one directory) in which you will create one or more projects (either in the solution's directory, or in one or several subdirectories. I you have in your components a shared library for example, you would put in a separate project.
The source files in each project are organized in the same directory. If you use folders in a project, these are virtual and not materialized in the OS directories.
Remark: If you really want to organise project files within "hard" subdirectories, you can always force the directory in the item creation dialog. This is particularly practical if you add to a visual studio projects existing items stored according to a more complex OS structure. Unfortunately such a directory structure is not at all displayed in the solution explorer, so it is somewhat confusing.

How to add class to openframeworks project in VS2012

I am normally a C# guy but trying to get into c++.
I made myself a new openframeworks project by copying and pasting one of the example projects and then renaming everything to my project name. (If there is an easier way, I would love to hear it)
This project has the .cpp and .h files in a sub folder called "src" which are in turn organized into virtual folders (filters???) in visual studio.
How can I add a class to this project from within visual studio?
If I right click on the src filter in the solution explorer and hit add class. It creates the class files at the root of the project not in the src folder. I mean it does this both in the solution explorer and where it physically places the files. This is a problem because I can't include my class files in the rest of my app, presumably because they aren't in the same folder
What is the proper way to add a class file?
When you right click on the filter (could be the "src" or a new one) and hit 'Add class', after hitting 'Add' in the first screen, in the next one you will find a [...] button besides each text input field for the .h .cpp files: with that button you can chose the folder where your files are going to be saved ('src' or any other).
It isn't a good solution but the only way I have found to do this is to add the class in visual studio, which places it in the root. Exclude the files from the project. Move the files to the src folder using Windows Explorer. Include them in the project by showing all files and then right clicking to include in project. At this point I would expect the files to be listed in the project but don't appear until I reload the project. Once the project is reloaded I then drag and drop the files into the src folder/filter