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!
Related
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.
For my project, I am using Visual Studio 2015. I have added to my include path the folder $(ProjectDir)Source. In details view of Include Directories, in the list below with Evaluated value, the correct path is listed. When I copy this path using #include "path/file", it finds the file. Or via Start > Run, it opens the path.
In my project I have a .cpp file which includes the file like usual:
#include <file>.
Still, I am receiving the error: Cannot open include file 'file.h' No such file or directory. Error C1083.
I copied an existing solution which had similar includes and adjusted them accordingly. It works now.
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!!!
I'm generating Visual Studio 2013 projects with Qt 5.3 qmake. In my .pro file, I've got the following line:
MOC_DIR = $$BUILD_DIR/<DEBUG OR RELEASE>/moc
If I message($$MOC_DIR), the path is correctly formed. However, when I build in VS, the moc_<CLASS>.cpp files are not generated in that location, but instead end up in the same directory as the .pro. I get the following warning during compilation:
Two or more files with the name of moc_<CLASS>.cpp will produce outputs to the same location
That's not surprising, because if I look at the contents of the generated .vcxproj, I see the following (irrelevant tags/text elided ...):
<CustomBuild Include="..\include\Class.hpp">
...
<Outputs Condition="...Release...">moc_Class.cpp;%(Outputs)</Outputs>
...
<Outputs Condition="...Debug...">moc_Class.cpp;%(Outputs)</Outputs>
...
</CustomBuild>
Why does is my custom MOC_DIR being ignored?
Other VS2013 projects generated with Qt5 qmake were placing the moc_<CLASS>.cpp files in the specified location, as expected, so my suspicion was that something else in the .pro was interfering.
I'm using Boost (1.55) and while adding Boost to the project, I came across the issue described in this SO question: link.
I added the following lines to the top of my .pro:
load(moc)
QMAKE_MOC += -DBOOST_MPL_IF_HPP_INCLUDED
... and that sorted out my macro argument mismatch bug. It also caused the bug described here. Calling load(moc) before setting MOC_DIR for some reason causes qmake to ignore the custom MOC_DIR. If you reorder load(moc) to be after MOC_DIR is set, everything works as expected.
My .vcxproj now looks as it should, my moc_<CLASS>.cpp files now placed into the correct <BUILD>/debug/moc or <BUILD>/release/moc directories.
However: I still get the same MSB8027 build warnings. This appears to be a known bug in Visual Studio. It confuses the situation, though, as I only broke the moc locations when I added load(moc), but I got the warning before the problem was introduced, while it existed, and now even after it's fixed! For now I'm disabling the warning; see Felix Huang's answer here.
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.