CritSec.h not existent (Win 8.1) - c++

I have this sample code I'm currently using to write a dll in c++.
In this file critsec.h is included.
However on my system (Windows 8.1 Pro 64bit) Visual Studio 2013 CE can't find the source file.
Am I missing some sort of SDK or something?

In the project file belonging you your example file, you see the following additional include directories (reformatted for better reading):
<AdditionalIncludeDirectories>
%(AdditionalIncludeDirectories);
$(MSBuildThisFileDirectory);
..\..\Common
</AdditionalIncludeDirectories>
And indeed, in ..\..\Common, you will find CritSec.h

How do you include this? There are two ways. If you you use #include "something.h" the file has to be at the same location where youre .cpp is. If you use #include than the header has to be at a directory in visaul studio.

Related

Does VS2015 automatically include windows SDK header files but not in VS2017?

I have a C++ library originally developed in VS2015 which uses SOCKET from Winsock2 inside Windows SDK 8.1. The solution file is generated from a cmake file, and it builds perfectly fine.
I use the same cmake file to create the solution again in VS2017. However, I can not compile it unless I add #include <WinSock2.h> at the file where SOCKET is being used. It looks like it's not picking up the definition of SOCKET unless I explicitly include the WinSock2.h file. And I don't need to do that in VS2015.
I checked the project properties and they look the same and are both using Windows SDK 8.1. So what is the difference here with VS2015 and VS2017? Does VS2015 automatically include windows SDK header files but not in VS2017?

C++ Including Visual Studio header files in Qt project. <xstring> include error

I have found a library to generate barcodes (libbarpp). I would like to use this library in my Qt project.
Doing a svn checkout of the source: http://libbarpp.googlecode.com/svn/trunk/ reveals a nice VS example in the src folder. I opened the project in VS and found the included header files. I have included these header files in my Qt project, however i encountered a problem when several of the files required a system header file
#include <xstring>
In VS i can see the this file is located in (on my system):
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring
However the files does not have any extension and i don't really know what to do with it.
Do i need to include something in my Qt project file in order to use this VS file?
I tried including
CONFIG += stl
to my Qt project file, but with no luck.
Any help or comments is greatly appreciated.
EDIT: I'm using Qt 5.2.1 with MinGW compiler
xstring is a Microsoft specific header that contains implementation of std::basic_string and some related specializations.
It shouldn't be included directly in the first place and unless the code you are talking about is using something implementation specific from that file you should be fine replacing it with just:
#include <string>

Creating a C++ visual studio project based on existing files

I've never worked with C++ or C. I'm trying to create a Visual studio project based on existing files which can be found here: example1.cpp together with the resources. As you can see this is example code of a book for OpenGl. I have opengl and glut present on my computer and they work ( tested it).
Based on the files mentioned above a created an empty C++ project in visual studio 2012 (i also have other versions installed if you can provide a solution in 2010 or so). I included the header files & the source file. Though I still get the following in my IDE:
with errors such as:
cannot open source file "Angle.h"
( Though the file is present in the project)
Can anyone tell me how I get these files to compile and run ?
Make sure that the file angel.h it's in the same path that the .cpp file.
Header files need to be in same directory with source files in order to use #include with quotes.
#include "header.h"
In other words Angel.h must be in same directory with example1.cpp.
However,you can add spesicific paths to your project from Project Settings>VC++ Directories and include header files which exists in those paths using
#include <header.h>

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.

Using Windows header files within Netbeans 6.8

I'm trying to make an windows application within Netbeans.
When using Visual studio it is no problem to use files like tchar.h
I have receaved a basic file structure containing those and I'm trying to get them to work on Netbeans IDE but it seems that Netbeans won't allow using files from Visual Studio.
I have tried to add the tchar.h file and all other file it required (including some C++ core files) and commenting the errors written in those care files:
#error ERROR: Use of C runtime library internal header file.
But netbenas can't find the tchar.h file while being in same folder...
If you're using gcc you might consider using the unix style wide characters instead of the microsoft specific version. Look at wchar.h
http://en.wikipedia.org/wiki/Wchar.h