Visual studio c++ problems including poco - c++

I am new to c++ and visual studio and am struggling with getting an include statement to work. I want to test out poco for online applications with c++ and found a basic example online that used
#include <Poco/String.h>
However, my Win32 project in visual studio throws an error stating "could not open include file". I added the path to project properties < VC++ Directories < Include Directories. I also added the path to linker < input < additional dependencies. I can't seem to get rid of that red underline and error though. When I am typing my include statement a list pops up but the directory listed is the "...Windows Kits\8.1\um\". Could anybody lend me a hand? I really appreciate any help. Thank you. Let me know if I can provide more info.

It should be added to 'C/C++ > Additional Include directories'
and it should be added as:
c:/some_folders_down
not
c:/some_folders_down/Poco
You say, 'Adding the directory'. You don't want to add the Poco folder to your path because when you #include <Poco/String.h> you are adding that part of the path there. Try:
#include <String.h>, if that works, fix your additional include path. Would you paste that path?

So apparently the default for visual studio is to add the the "additional directories" paths to Debug x64 since I am on a 64 bit OS. However, I forgot to switch to x64 in the solution platform drop down at the top of the VS window. If you right click on the .vcxproj and search for "AdditionalIncludeDirectories" you can view this directly. I feel like a facepalm is in order haha. Thanks so much to everyone who viewed my question.

Related

How can I tell Visual studio where my additional .dll files are?

I have recently switched my IDE to Visual Studio 2019 for C++ projects. I easily followed a tutorial into setting up a new library like SFML into visual studio, and tell it where the additional include and library directories are.
But there is something else that is required for it to work, which are the .dll files. Every page I followed, even the Documentation by the SFML website, it says that they have to be in the same directory as my project. That means I need to copy-paste the 7-8 files into my project directory. This really makes the folder look untidy. I would like to create a new folder and tell Visual Studio where those files are. I tried going doing this
Project -> Properties -> Linker -> Input -> Additional dependencies
Usually, the lines that would work are
sfml-system-d.lib
sfml-window-d.lib
...
I tried doing $(ProjectDir)valid path\ sfml-files.lib but this gives me the linker error, saying that It could not find the file.
If I simply move the .dlls into a folder without doing anything, the code would compile and link fine. But when it runs, Windows gives me a pop-up box with the same error message.
Here is how it currently looks
Looks really messy, I just want to be able to move them into dependencies like how src contains the source files.
How can I achieve this?
As it is now, it works perfectly fine. The issue only occurs when I try to create a new folder.
I hope I have covered the important information required for a good answer, If not please let me know what more I should add
Microsoft Visual Studio 2019
Currently running 64-bit platform with Debug configuration. Hence the -d suffix
You could create a path environment for your specified directory, which is like drescherjm’s suggestion. The steps:
Right-click “This PC” -> “Properties”-> “Advance System settings”
Click “Environment Variables”
In the System Variables group, edit “Path”
Add your directory, for example: ”D:\ SFML-2.5.1\bin”
Restart your visual studio and re-open your project
The easier solution might be to put them in the x64 subdirectory. This allows you to have various builds side by side (x86/x64, debug/release).
Since this x64 directory is where the EXE is located, it is the first directory searched for DLL's. It will take precedence over the Path solution suggested in the other answer. The Path directories are searched last of all.

d3dx9.h: no such file or directories [duplicate]

Edit: Of course, immediately after working on it for an hour then posting here, I found the stupid mistake...
I'm getting compiler errors when trying to #include <d3dx9.h> in a project. I'm receiving "fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory".
I do have the DirectX SDK installed (I also just tried reinstalling it to no avail).
In the Project Properties:
VC++ Directories are set to "$(DXSDK_DIR)Include;$(IncludePath)" and "$(DXSDK_DIR)Lib\x86;$(LibraryPath)" for Include and Library directories respectively for all configurations—and the environment variable %DXSDK_DIR% points to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\ as expected.
C/C++ > General settings has $(DXSDK_DIR)include listed in the Additional Include Directories
Linker > Input > Additional Dependencies has d3dx9d.lib included for Debug and d3dx9.lib included for Release configuration.
I am able to successfully compile and run tutorial projects from the DirectX Sample Browser.
Visual Studio's Intellisense/autocomplete will find d3dx9.h and suggest type and function names that are within the file (and not included through anything else I'm #includeing) so it seems that Intellisense can find it.
Any suggestions on what I'm forgetting or what else to try?
Thanks
you forgot one thing:
Go to VC++ Directories -> Library Directories
add $(DXSDK_DIR)LIB\x86
apply.
Done. Hope this helps
You should make sure you have ALL paths sorounded by quotes (").
Instead of $(DXSDK_DIR)include you should have "$(DXSDK_DIR)include"
I didn't realize that one of the other projects in the solution was #includeing a file that was #includeing a file that was #includeing d3dx9.h and I hadn't added those paths to that project.
/facepalm
Find the file on your computer, and add it's folder to the properties of your project.
Assuming you have visual studio: Properties/C/C++/General/Additional Include Libraries.
I tried all of these suggestions and none worked.
Turns out the $(DXSDK_DIR) variable doesn't work if you install DirectX while Visual Studio is still running. The solution for me was to restart Visual Studio (+ adding the paths in the solutions listed above, of course).

visual studio not seeing my include files

This may be a very simple question but I haven't been able to figure it out so any help is appreciated.
I have a header that is located in a general folder because I want to use it in several projects for example:
C:\user\geninclude\program\header.h
I created a new empty project with a very simple main, in the main I put
#include <program/header.h>
I then went to the project properties and in VC++ in include directories added C:\user\geninclude\
but when I tried to build the program the program tells me it cannot find header.h because is not in the current directory or in the build system path.
I also tried in the project properties in C/C++ general Additional Include Directories adding C:\user\geninclude\ but still the same error.
I know is something simple I am missing, but I don't know what, I am very new to this just learning.
For reference I am using Visual Studio 2013.
Thank you in advance for your help.
UPDATE: Thank you all for your kind responses, I have tried everything you have told me (check release vs debug in both instances, change / for \ and <> for "", and double checking the header and still the system does not see it. It really is very weird. I'll keep trying...
Please check if your file is really an header file otherwise it won't appear on include.
What you can also do (as a workaround if you need that method fast) is to put your header file (or folder with header files) on the visual studio "include" folder. The path should look like this "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"
PS: You should also check the properties configuration when you're adding the path to VC++ include directories. You could be adding the path to debug configuration and trying to run it in release mode.
You do indeed want
Project Properties -> Configuration Properties -> C/C++ -> Additional Include Directories
(or something close to that; I'm using VS 2008). Make sure the configuration you're editing in the top left (debug/release) matches the configuration you're building with (typically visible up top in the main window). So it sounds like you may have done it correctly; I'd double-check for the file's existence in that location. You could also try program\header.h instead of program/header.h. If none of those work, try adding C:\user\geninclude\program to the include directories (no \ at the end) and change it to #include "header.h". If that doesn't work either, you've almost surely got the header file in the wrong spot.
Another thing that can cause include files not being picked up is a difference between the platform set in your c++ project's Property Pages and your "Active Solution Platform" in configuration manager. Can just check if one is set to x64 and the other x86
check if you have specified the path correctly. for example I had written cpp instead of c++ and therefore suffered a lot and wasted like an hour searching here and there.
For Visual Studio 2019 users:
Project(P) > yours_project_name properties(P) > Platform Toolset Visual Studio 2019(V###)
Reasoning: You might download the project from Online and they used other version of Visual Studio as Platform.
Project(P) > yours_project_name properties(P) > Windows SDK Version ##.#(latest installed version).
Reasoning: You might download the project from Online and they used version SDK 8.0 while you have SDK 10.0
ntucvhw

Visual Studio Cannot open include file; No such file or directory

Linking files is going to be the death of me.
So, I have had this problem many times before in both Visual Studio for C++ and Eclipse for Java. Right now I'm having problems in visual studio while trying to setup a project so I can start messing around with the Kinect SDK. The first thing I did was to include the NuiApi.h
#include <NuiApi.h>
I made sure to go into the VC++ directories and add the correct include directories $(KINECTSDK10_DIR)\inc and $(KINECTSDK10_DIR)\lib\x86 for the library directories. I also went to the Linker and added the Kinect10.lib in the additional dependencies in the Input section.
I still had the problem even after including these directories into the project. So I did some exploring and went to C/C++->General and added the include directories in the "Additional Include Directories" portion again just to see if that would fix it... that did nothing.
So I went back to the linker and added the library directories under General in Additional Library Directories to see if that would do anything and it still has not.
I'm at a complete loss right now and am so confused as to why these files aren't being included correctly! I swear this happens every time I try to work with a new API and I have to fiddle with it until it starts working for some reason. Am I doing something wrong? Am I missing something stupid? Does anyone have any ideas?
The difference between quoted and the angle-bracket form is explained here for visual studio. In principle, the quoted form is used for project specific includes, whereas the angle form is used for system libraries. In your case, the angle-bracket seems to be the right form.
What you have to do is to add the include to the C++ directories :
Right click on project -> Properties
VC++ directories
You should keep in mind that this setting is configuration-dependent, i.e. you have to do it for debug mode, but you'll have to repeat it for release mode.
Finally, you should make sure that the environment variable KINECTSDK10_DIR points to the right location (Windows+X -> System -> Advanced system parameters -> Environment variables). Attention: if you edit these parameters, you'll have to restart visual studio so that the new environment is taken into account.

Cannot open include file: 'd3dx9.h': No such file or directory [duplicate]

Edit: Of course, immediately after working on it for an hour then posting here, I found the stupid mistake...
I'm getting compiler errors when trying to #include <d3dx9.h> in a project. I'm receiving "fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory".
I do have the DirectX SDK installed (I also just tried reinstalling it to no avail).
In the Project Properties:
VC++ Directories are set to "$(DXSDK_DIR)Include;$(IncludePath)" and "$(DXSDK_DIR)Lib\x86;$(LibraryPath)" for Include and Library directories respectively for all configurations—and the environment variable %DXSDK_DIR% points to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\ as expected.
C/C++ > General settings has $(DXSDK_DIR)include listed in the Additional Include Directories
Linker > Input > Additional Dependencies has d3dx9d.lib included for Debug and d3dx9.lib included for Release configuration.
I am able to successfully compile and run tutorial projects from the DirectX Sample Browser.
Visual Studio's Intellisense/autocomplete will find d3dx9.h and suggest type and function names that are within the file (and not included through anything else I'm #includeing) so it seems that Intellisense can find it.
Any suggestions on what I'm forgetting or what else to try?
Thanks
you forgot one thing:
Go to VC++ Directories -> Library Directories
add $(DXSDK_DIR)LIB\x86
apply.
Done. Hope this helps
You should make sure you have ALL paths sorounded by quotes (").
Instead of $(DXSDK_DIR)include you should have "$(DXSDK_DIR)include"
I didn't realize that one of the other projects in the solution was #includeing a file that was #includeing a file that was #includeing d3dx9.h and I hadn't added those paths to that project.
/facepalm
Find the file on your computer, and add it's folder to the properties of your project.
Assuming you have visual studio: Properties/C/C++/General/Additional Include Libraries.
I tried all of these suggestions and none worked.
Turns out the $(DXSDK_DIR) variable doesn't work if you install DirectX while Visual Studio is still running. The solution for me was to restart Visual Studio (+ adding the paths in the solutions listed above, of course).