How do I make Visual Studio 2010 include Windows DDK 7.1.0 files properly? - visual-studio-2010

I'm trying to build a VS 2008 project written by someone else who is currently AWOL in VS2010. I need help with the WinDDK includes, particularly with hidsdi.h.
I've installed the WinDDK and VS2010 on a clean install of Win7. In Properties -> VC++ Directories -> Include Directories, I have added C:\WinDDK\7600.16385.1\inc\api, as well as \ddk and \crt. In Properties -> VC++ Directories -> Library Directories, I have added C:\WinDDK\7600.16385.1\lib\win7\i386.
However, when I attempt to build the project, I get repeated instances of
"error C3861: 'HidD_SetOutputReport': identifier not found" and "error C3861: 'HidD_GetInputReport': identifier not found
I opened up hidsdh.h from the following code block:
extern "C"
{
#include "setupapi.h"
#include "hidsdi.h"
}
And the functions listed in the error reports are present within the header file in question. Clearly, I'm doing something wrong with the include paths. Some assistance would be greatly appreciated.

You must not be defining NTDDI_VERSION or you're not defining it correctly. As you can see in hidsdi.h, the definition of HidD_SetOutputReport is conditional on this:
#if (NTDDI_VERSION >= NTDDI_WINXP)
NTDDI_VERSION determines what versions of Windows you're going to support. The appropriate values can be found here.

Related

How do I link OpenSceneGraph libraries and includes to Visual Studio properly?

I am trying to compile and build the first basic example from the OSG 3.0 Beginner's Guide (Rui Wang, Xuelei Qian) run on Windows 10 (Build 18363) with Visual Studio Community 19 (16.7.3).
The code looks like this:
#include <osgDBd/ReadFile>
#include <osgViewerd/Viewer> //the "d" is supposed to be there when in Debug solution configuration
int main(int argc, char** argv)
{
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("cessna.osg"));
return viewer.run();
}
But the error messages are:
Error (active) E1696 cannot open source file "osgDBd/ReadFile"
Error (active) E1696 cannot open source file "osgViewerd/Viewer"
Error C1083 Cannot open include file: 'osgDBd/ReadFile': No such file or directory
So I rechecked my solution properties, which I had set up following OSG's online documentation "compiling with visual studio" (Linker, C++ properties, ...), as well as my environment variables in Windows OS.
The recommended cmd commands, should something be out of order, didn't help either.
(I deemed it less cluttered leaving out all those screenshots, but I can of course upload them if wished)
I also compared my settings to this answer: How to add additional libraries to Visual Studio project? , which I thought same.
I should add, that I built OSG on a separate drive than Visual Studio or Windows, but I believed setting the environment variables properly should be ok.
Help would be greatly appreciated.
Thank you.
Have you set %OSG_ROOT% ?
I'm not sure what is in the guide, but my typical installation is to set Windows environment variable OSG_ROOT to the main OpenSceneGraph folder in my Program Files (x86), then to add $(OSG_ROOT)\include to my additional include folders and $(OSG_ROOT)\lib to my additional library folders.
Also, it looks like the example you are using has a "d" added to the folder names - should just be osgDB/ReadFile and osgViewer/Viewer for the Release versions - maybe they wanted you to build the debug libraries and add such folders for your includes? I get having a separate lib and bin but I don't know why they would want a separate include folder for Debug vs. Release, so my suggestion would be to remove the d from the include statements, e.g. osgDBd --> osgDB, osgViewerd --> osgViewer, etc.
Unfortunately, the Example applications in the OSG Solution reference the local build folders, not the installed folders, so will not serve as an example of how to reference OSG from its installed location. However, if you are ok building from the local build folder, you could just use the project settings from one of the Examples.

Create CMake file from Visual Studio Project

I have finished a project developed in Visual Studio 2013 (Windows) using OpenCV. Now, my manager told me he needs the code files and the CMAKE file.
I'm reading this documents:
https://cognitivewaves.wordpress.com/cmake-and-visual-studio/
http://www.cmake.org/cmake-tutorial/
but I don't understand properly and I don't know if they are what I need...
I can explain a little bit more my project:
My project has:
main.cpp
Some .cpp created by myshelf.
Some .h created by myshelf.
I use OpenCV libraries (lib, dll, ...)
I use Vimba libraries (lib, dll, ...).
I have never worked with CMAKE files... Could anyone lead me about how create this file/s?? I'm really missed...
THANKS in advance!!!
Any help is welcome!
I have achieve create the makeFile. It's working properly in Windows. I execute cmake and from the code files it create the visual studio project properly and it works fine.
BUT when I try to execute the make command in LINUX I get errors :S:
*In function ..... error: 'infinity' des not name a type const auto....
*.... error: 'infinity' was not declared in this scope
*.... error: 'infinity' was not declared in this scope
*.... error: 'infinity' was not declared in this scope
The line where is the problem is this one:
const auto infinity = std::numeric_limits<int>::infinity();
It's a line from this project: https://github.com/soimy/munkres-opencv/tree/master/src
I think the problem is defining a infinity limit... Could anyone lead me to solve this problem?
THANKS!!!

Where can i find the 16F877A.h?

When i run my program in MPLAB. ( Project wizard -> PIC16F877A -> Hi Tech Ansi C Compiler -> RUN )
Error [141] C:\Users\WhyWhy\Desktop\test.c; 1.22 can't open include file "16F877A.h": No such file or directory
Where can i find the header file for the 16F877A?
Chip-specific header files should not be explicitly included in HITECH-C, the documentation clearly states that. Instead, you include the compiler header, which will take care of including the chip-specific file for you:
#include <htc.h>
All you need for this to work is to configure correct chip in the project settings. The 16F877A.h file exists in the compiler directory, but including it directly will throw a warning.
C:\Program Files\HI-TECH Software\PICC\9.70\include
In my case , I have installed HITech Compiler In C:\ Program Files.
You have to know, where have you installed the files of the compiler.
This file is from the compiler, so in your case the Hi Tech you can find here:
C:\Program Files\HIā€TECH Software\PICC\\include\
Before you have found the file you have to add in the Header Files folder in the Project window on MPLAB.
And in your code you have to include it
#include <16F877A.h>

Why Visual Studio cannot find 'tr1/unordered_map?

I want to use google-ctemplate in a project. But if I include the basic file, I get the following error (with Visual Studio C++ 2005):
Error 1 fatal error C1083: Cannot open include file: 'tr1/unordered_map': No such file or directory f:\entwicklung\libraries\ctemplate-0.99\src\ctemplate\template_cache.h 39
I can find the unordered_map.hpp in the boost-directory and the boost-directory is set in the include-path in Visual Studio. How can I solve this problem?
I found out what the problem was. I included the wrong directory from google-ctemplate. Instead of src I have to use src/windows.
But that triggers another Problem, this time from the linker.
As is, you can use:
#include <boost/tr1/unordered_map.hpp>
Alternatively, add your $(boost-directory)/boost/tr1/tr1 to the include path and use:
#include <unordered_map>
See this Header Include Style for more details.
Note: I'm assuming $(boost-directory) is set to something like "C:\boost_1_46_0".
Considering that TR1 was not published until the summer of 2005, I wouldn't be surprised that it isn't present in VS 2005. You might try a more up-to-date version of the compiler!

cmath.h and compile errors

I used to work with math.h without any problem. Now, I use an external library which itself has a file called math.h, but which includes < cmath>.
Adding this library to my project (or even just adding the include directory, without touching the code) now generates tons of errors from < cmath> :
C:\Program Files\Microsoft Visual Studio 8\VC\include\cmath(18) : error C2039: 'acosf' : is not a member of '`global namespace''
C:\Program Files\Microsoft Visual Studio 8\VC\include\cmath(18) : error C2873: 'acosf' : symbol cannot be used in a using-declaration
C:\Program Files\Microsoft Visual Studio 8\VC\include\cmath(18) : error C2039: 'asinf' : is not a member of '`global namespace''
C:\Program Files\Microsoft Visual Studio 8\VC\include\cmath(18) : error C2873: 'asinf' : symbol cannot be used in a using-declaration
[etc, etc...]
I don't understand why this happens. I am using Visual Studio 2005 and looking on the internet, it seems that this problem is solved under VS 2008. However, I'd like to stay on VS 2005...
Including using namespace std; everywhere, or changing the order of my includes doesn't seem to change anything. Defining _STD_BEGIN solves the error, but produce as many in < xlocinfo>.
How can this be solved?
Same Problem exists in VC 10. I think, that <cmath> includes itself a math.h but insted of the correct one, which is shipped with VC it uses the one which is created in the User-Project (with different content of course).
Solution: Do never use a File named math.h in your Project... (Or correct the std somewhere).
I'm not sure I read your question correctly but it seems odd that a library would ship it's own math.h file.
Perhaps you are suppose to put the parent directory in your include path so that <my_lib/math.h> can be included without conflicting with your compiler <math.h>?
The problem is probably mixing C libraries with C++ conventions. For instance:
#include <math.h>
namespace TEST {
}
This compiles fine, whereas:
namespace TEST {
#include <math.h>
}
This generates a large number of spurious errors.
Just to confuse the issue:
#include <math.h>
namespace TEST {
#include <math.h>
}
This also compiles as it can only be included once (the first time).
Hence also:
#include <math.h>
namespace TEST {
#include "SomethingThatIncludesMath.h"
}
Will work, whereas:
namespace TEST {
#include "SomethingThatIncludesMath.h"
}
Won't.
You can also get similar problems by including C++ headers into a *.c file, rather than a *.cpp file.
I am sure that other similar mixing of C and C++ can lead to similar problems.
(1) According to Microsoft, the C2873 means;
'symbol' : symbol cannot be used in a using-declaration
A using directive is missing a namespace keyword. This causes the compiler to misinterpret the code as a using declaration rather than a using directive.
(2) Also when I had C2873 with C2039 (I tried to merge CEF3 and Cinder), somehow I bypassed the both error by changing Properties->Configuration Properties->C/C++->Code Generation;
Enable Minimal Rebuild: Yes(/Gm), Enable C++ Exception: Yes(/EHsc), Enable Function-Level Linking: empty

Resources