Visual Studio Online, Pathing, C1083 and stdafx.cpp - c++

So, I'm taking this class.... wince
My day job is pretty technical, but I'm a complete Visual Studio newbie.
I have a Visual Studio Express 2013 project that runs/compiles fine on my local system, but I have to get it to build in Visual Studio Online, so I can share it with the other people in my class.
The very first line of my program is:
#include "stdafx.h"
When I attempt to build my program in the online build environment, I get an error:
Error C1083: Cannot open source file: '..\..\..\..\..\path_to\file_on\my_local\computer\Project\stdafx.cpp': No such file or directory
The stdafx.cpp and .h files are in the project folder in source control, along with the main.cpp file, as well as showing up earlier in the build log when the project is cloned. But according to the #include directive docs the very first place it looks should be the directory where the main.cpp file lives?
Looking at the XML content of the .vcxproj filters files, I'm seeing an entry that looks like this for every file in the project:
<ItemGroup>
<Text Include="..\..\..\..\..\path_to\file_on\my_local\computer\Project\ReadMe.txt" />
</ItemGroup>
And I'm wondering if that's related, and/or somehow overriding the normal behavior of #include. However, I can't find a way to edit those from within Visual Studio (I mean, okay, I could open the file in Notepad++ or something, but that can't be the 'right' way... can it?)
So, is there a (preferably simple) way to tell my VS project to just look in "." for things?

In my case issue related to space is present between folder name, .sln path should not contain folder name with space, like 'foo foo', it should 'foofoo' or 'foo_foo'

Related

visual studio 2019 - C++ cannot open source file

I am using Microsoft Visual Studio Community 2019 Version 16.8.4 on a Windows 10 machine.
I have established that my include files live in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" because I can actually see them listed there. However, I get an error with the line #include <cstdio>.
I have tried right click on project name to bring up a context from which I chose 'Properties'. From the "Solution Project1 Property Pages", I selected "Debug Source Files" and then entered the full directory path to the include files.
I still get the error
You need to add the directory where the headers are found to the project properties under either C/C++ -> Additional include directories or VC++ -> Include directories.
And note that you need to make sure that the directory is added for all project configurations/platforms you wish to be able to build. The Debug source files item is only so that files can be found when running the debugger and have nothing to do with the project build stage.
I ran Visual Studio Installer and noted that one of the workloads, 'Desktop development with C++' had not been activated. After activating it and downloading the required or missing binaries, I am now able to create an empty project using an example of the quintessential 'Hello World' program such as #include int main(){printf("Hello, world");return 0;}
#include <cstdio> is part of the C++ Standard Library headers, if you are getting the error E1696: 'cannot open source file, you might have to retarget the solution/project. Do the following:
Right-click the Solution in the Solution Explorer pane;
Retarget solution;
Follow the steps/press OK.
It worked for me when I couldn't find Standard Library headers, hopefully, it works for you as well.

fatal error: sal.h: No such file or directory

I know that there are other errors for certain header files with the same message of "No such file or directory", but my circumstances are a bit different as I will explain now.
I use the Code Blocks IDE and wanted to start using the UI Automation library. When I tried to include the header
#include UIAutomation.h
Code Blocks could not find the header. From there I looked around my computer and saw that the UIAutomation.h, UIAutomationCore.h... and the other UIAutomation headers were in an "Include" file in the "Microsoft SDKs" folder.... So I went to (Settings -> Compiler -> Search directories) and in there I added a new directory to the include folder where the UI Automation headers were:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;
and Code Blocks found the headers. However... another error appeared:
fatal error: sal.h: No such file or directory
and I searched for the sal.h in the "\Include" folder I had just written code for and there was no sal.h file. I understood everything up until here... I had to check if I had a sal.h folder somewhere else on my computer and I did, in a file somewhere in my Visual Studio 10 IDE folders (just to let u guys know, I use code blocks cause I have been using it for a long time, and only downloaded VS10 recently to use spy++). So then I thought ok... I'll do the same thing I did before again so that I can include those files too, so I go back into the Search directories section and add the directory:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include
but from there a million different errors appeared, all refereeing to different issues. Can anyone tell me what I did wrong? All I wanted to do was use the UI Automation headers so that I can start coding with the library, but that is proving to be a bit difficult...
From what one can get from this related Q&A: 'How do I get sal.h' it's not possible to use this stuff with a different toolchain than MSVC (Visual Studio).
You may consider to configure MSVC as toolchain for this codeblocks project.

Visual Studio not using additional include directories for KinectBridgeWithOpenCVBasics D2D C++ Sample, but does for other solutions.

I'm working on adding some openCV features to a couple projects that use the Kinect and openGL/freeGLUT. I have downloaded and installed OpenCV using the pre-built libraries and successfully run a simple sample. Now I want to work with the Kinect Bridge with OpenCV Basics sample from the Kinect for Windows Developer Toolkit to get a better idea of how to use OpenCV with the Kinect. I downloaded the sample into my projects folder, opened the solution in visual studio and built it. I got the following errors:
Error 1 error C1083: Cannot open include file:
'opencv2/core/core.hpp': No such file or
directory c:\users\justin\documents\visual studio
2010\projects\kinectbridgewithopencvbasics-d2d\OpenCVHelper.h 17
and
Error 2 error C1083: Cannot open include file:
'opencv2/core/core.hpp': No such file or
directory c:\users\justin\documents\visual studio
2010\projects\kinectbridgewithopencvbasics-d2d\OpenCVFrameHelper.h 13
Initially I thought these errors were due to forgetting to specify the additional include directories. I added the same property sheet that my other OpenCV projects use to this one, but the errors remained. I tired copying the header files into the project folder: same thing. It seems like the only thing that works is specifying the full absolute file paths in the #include statements. I want to avoid doing this because visual studio wants me to change every #include in every file used in the project, including the openCV header files. I also tried shortening the name of my project folder in case the file path was too long (though I'm pretty sure that's more of an issue for the header file paths), but again no change.
The include directories and #includes that I'm trying to use are the same as in my other projects. I'm using Visual Studio 2010 on Windows 7 x64 based system.
Why would the additional include directory work for other projects, but not this one?
Usually when I see something like this it turns out to be a bad character in one of the prior include paths or other options that's messing everything up after it. I would take a look at your the command line page in the project configuration and see if you can spot anything amiss.

Visual Studio 2010, C++, Cannot open include file: 'base.h'

I'm trying to build a project in Visual Studio 2010. But I get the following error:
fatal error C1083: Cannot open include file: 'base.h': No such file or directory
This is a part of the code from (stdafx.h) generating the error:
// from Base project
include "base.h"
include "basic.h"
include "logfile.h"
It seems that the project uses "MFC Microsoft Office Fluent User Interface (the "Fluent UI")".
Do I have to install anything else than Visual Studio for using it?
Something that is missing, that generates the error?
I'm quite new to C++ and Visual Studio.
EDIT:
The problem is that I can't find the files: // from Base project #include "base.h" #include "basic.h" #include "logfile.h" And I don't really know what they are for. I guess some MFC stuff? And they are not anywhere on my disk.
I'm using Windows 7, I don't know on which OS the project is developed on. Can it be that it's developed on WinXP for instance? In that case, do I need to install the SDK for WinXP?
The Fluency UI is part of a MSVC++ feature pack, which you will have to install on top of Visual Studio (you can dowload it following the links in the given page).
In particular the error is due to the fact that the compiler cannot find the file base.h, which could be because it is part of the above mentioned feature pack (and thus it is currently missing) or (if the file does exist on your computer) because your include path (the path the compiler consults for finding included files) is set up incorrectly
Make sure base.h available in the working directory
Right click the base.h (From code editor) and click open document in the context menu (first menu item)
Search that file in your project root folder, then make sure that the path for the file is available in the additional include directory. Project property page --> Select C/C++, first entry on the right side grid.
The problem with this was missing files in the project. Thanks for the help.

Trouble With Building Live555 Media Server in VS2005

This could be a very silly question to any long time C++, visual studio or live555 users but I am having problems building the live555 source code with visual studio 2005. I have found a good walk through guide for creating the projects manually because .mak files are no longer supported by newer versions of visual studio but am still having problems. It seems that visual studio cannot open the .hh files that come in the include folders and I have added to the header folders of each seperate project.
Is there something special you have to do to the compilier or a plugin for the IDE to allow VS2005 to open .hh header files?
This is the error I am getting:
fatal error C1083: Cannot open include file
'BasicUsageEnvironment.hh': No such file or directory.
It seems to me that Visual studios cannot find the file, rather than it not being able to open that file type. If you right click on your project and go to
Properties->C/C++->General->Additional Include Directories
Now browse to the location of the .hh file and add it to the path. Visual studios should now be able to find the file in question. You may also have to add library paths to your solution. Please let me know if there are additional errors.