__REQUIRED_RPCNDR_H_VERSION__ - c++

I create a header file from an IDL . The IDL file has been compiled in Visual C++ 2005 .
The generated header file contains #define REQUIRED_RPCNDR_H_VERSION 475 .
I tried to use this header file in Visual Studio 2003 , where rpcndr.h contains
{
#define RPCNDR_H_VERSION ( 450 ) // and
#if ( RPCNDR_H_VERSION < REQUIRED_RPCNDR_H_VERSION )
#error incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler.
#endif
}
Since 450<475 , i get a compile time error . Is there any way i can use the header file in Visual Studio 2003 . Do i need to make changes in the compiltaion setting of idl file .
PS : I have to compile the idl file in Visual C++ 2005 only . ( I do not have a choice to compile it in VS 2003 ) .

If your 2003 and 2005 configurations are using the same version of the Windows SDK, you might be out of luck (and/or just need to hack it and hope it works). Usually, though, you can make them compatible if they are using the same version of the SDK utilities and headers.
I don't have any info specific to this issue, but I have had similar problems in the past which I have resolved by pointing both versions of VS to the same later SDK version.

Related

OpenCASCADE 7.6.0 not compiling with a .NET 6.0 class library with Visual Studio 2022 (Windows 10)

Steps to reproduce:
Install a version of Visual Studio (I used VS Community 2022). Install OpenCASCADE 7.6.0.
Create a C++ .NET CLR project using Visual Studio 2022 targeting .net6.0.
Change settings to include OpenCASCADE header and library files.
Edit the main header by replacing the code within it with below:
#pragma once
//for OCC graphic
#include <OpenGl_GraphicDriver.hxx>
//wrapper of pure C++ classes to ref classes
#include <NCollection_Haft.h>
namespace ClrClsLibDotNetCoreMwe {
public ref class Class1
{
// TODO: Add your methods for this class here.
};
}
Attempt to build.
Issue: The build fails with the following complain:
1>C:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\inc\NCollection_DefaultHasher.hxx(34,1): error C2872: 'HashCode': ambiguous symbol
1>C:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\inc\NCollection_DefaultHasher.hxx(34,1): message : could be 'HashCode'
1>C:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\inc\NCollection_DefaultHasher.hxx(34,1): message : or 'System::HashCode'
What fixes the problem:
Either Targeting .NET Framework instead of .NET Core (/clr instead of /clr:netcore).
Or removing one of the headers.
Please see if there is a way where I can keep both the headers and target .NET Core?
I have looked around for a possible solution before posting this question here. A promising solution was to disable implicit usings. However, that didn't pan out.
I had the same problem.
In my case, the "using namespace System;" included in the header file. The text caused the problem.
Thanks!

trouble with setting up OpenCV 4.1.1 on Visual "Microsoft studio 2019" ? (Illegal Instruction.)

I am trying to use Open Cv on Visual studio to write c++ code. I tried a lot of ways to reach this goal for 3 days. here is what I did in these days:
**1.download and extract open cv 4.1.1 (C:\opencv).
2.download and install Visual Microsoft Studio 2019.
3.copy the bin directory of open cv to the system variable path.
(in my case:"C:\opencv\build\x64\vc15\bin;C:\opencv\build" )
4.add include folder to the project's properties(my project name is opencv):
(properties->configuration properties ->edite include directories value to : (C:\opencv\build\include )
5.edite library directory to ( C:\opencv\build\x64\vc15\lib)
6.then in linker menu->inpute->adittional dependancies -> edit its value to "opencv_world411d.lib" .**
now I write a simple code to test open cv:
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main() {
Mat im = imread("cameraman.tiff", 0);
}
this code built correctly but when I run it It doesn't work with error :
Unhandled exception at 0x000007FEBA8D3AE2 (opencv_world411d.dll) in opencv.exe: 0xC000001D: Illegal Instruction.
gfluidimgproc_func.simd.hpp not found
You need to find gfluidimgproc_func.simd.hpp to view the source for the current call stack frame
"I added screenshot"
error report
also, I tried Cmake too.
first, configure and generate OpenCV's source file.
second, open the project in Microsoft visual studio and build all
then I build the install folder.all has been done successfully.
questions:
1.how can I fix this error to run OpenCV on Microsoft visual studio 2019 ?
does Microsoft visual studio 2019 support open cv 4.1.1? have you tried it?
tanks for your attention.
my operation system is: windows 7
intel core i5
>>4.add include folder to the project's properties(my project name is opencv): (properties->configuration properties ->edite include directories value to : (C:\opencv\build\x64 )
This is wrong, you should add C:\opencv\build\include and C:\opencv\build\include\opencv2 to the include directories in your case.
I test your case on My PC, I use VS2019 and OpenCV4.1.1 to make a test. Your other steps are correct. This step will cause the header file not to be found, so the corresponding function can not be identified and will be displayed as illegal instructions.
I have the same problem and from what I understand it is because we compile in x64 bit and execute it on an old CPU which doesn't support sse3 instructions (in my case an old i5 750). I believe your only solution is to recompile OpenCV either in 32bit or in 64bit with sse3 disabled.

Visual Studio 2013 Express - How do I add resources?

I'm currently linking to the >dynamic< libs in SFML but I have no idea how to add resources in Visual Studio 2013 Express C++. I've quite recently started out with C++, coming from C# where adding resources is as simple as drag-n-drop.
I know there's something with .rc files and headers, but I didn't find any guide on it. What I need to do is add the dll's so I don't have to manually paste them with the .exe and I also need to add .png's. Right now I'm loading them from a folder next to the executable, I don't wanna do that.
How do I do this?
You can just add an [.rc] file to the project.
An [.rc] file is a purely textual resource script that you can edit as text, or you can use various 3rd party resource editors (you don't need that for adding image resources, just check out the RC syntax).
Visual Studio Express lacks resource editors, but does support automatic recognition of, compilation of and linking of resources.
Example
Here's an example [.rc] file, just a single line, using a free icon that I just downloaded from the net:
100 ICON "resources\\Bad-Blood-Yolks-Grin.ico"
Corresponding C++ source code, presenting the icon in a message box:
#undef UNICODE
#define UNICODE
#include <windows.h>
auto main() -> int
{
MSGBOXPARAMS params = {sizeof( params )};
params.hInstance = GetModuleHandle( nullptr );
params.lpszText = L"Click OK to dismiss this box.";
params.lpszCaption = L"Καλὴ τύχη!"; // "Good luck!" in Greek.
params.dwStyle = MB_USERICON;
params.lpszIcon = MAKEINTRESOURCE( 100 );
MessageBoxIndirect( &params );
}
Result:
All done in Visual C++ Express for Desktop 2013, or whatever it calls itself. :-)
In order to synchronize identifiers between resource script and C or C++ code it's common to include a header. The resource compiler understands the most basic C preprocessor directives.
Oh, also, I added the [.rc] file as just a text file. Visual Studio Express reacts to the renaming, "rc" file extension, by popping up a warning box that it isn't supported. Just ignore the box, and to edit the file right-click and choose text editor.

having trouble compiling old VC++ 6 c++ code

I am trying to compile MSVC 6 C++ code using MSVC 2008 Express on 64 bit windows 7. When I tried to open the .sln file, I get the error "project file dpcwebcfx.vproj could not be loaded". I don't have the .vproj file, but I do have dpcwebcfx.dsw file. So in the .sln file I changed
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dpcwebcfx", "dpcwebcfx.vcproj", "{355F3EB4-3B37-4272-B454-340E9B3BD9D3}"
to
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dpcwebcfx", "dpcwebcfx.dsw", "{355F3EB4-3B37-4272-B454-340E9B3BD9D3}"
Now I get an error converting the dsw file: Cannot load the project due to a corrupt project file. What should I do? Am I missing a file so that I can't open this project?

error "Cannot open include file", but it's not included in code

I got the error after installing November CTP in Visual Studio 2012.
The error is in unordered_set.hpp of boost library. But I have not included unordered_set or initializer_list anywhere in the code. I used boost only in one file and I am sure it's not the reason.
error in unordered_set.hpp:
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
#include <initializer_list> //error C1083: Cannot open include file: 'initializer_list': No such file or directory d:\boost\unordered\unordered_set.hpp
#endif
EDIT:
I uninstalled November CTP after, but still got the same error.
C++11 is enabled by default in VS2012.
From boost headers
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
#include <initializer_list>
#endif
You may try to define BOOST_NO_0X_HDR_INITIALIZER_LIST, or find initializer_list header location.
// config/suffix.hpp
#if defined(BOOST_NO_INITIALIZER_LISTS) && !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
#endif
// config/compilers/visualc.hpp
#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0
# define BOOST_NO_INITIALIZER_LISTS
#endif
BOOST_STRICT_CONFIG may be commented in config/user.hpp.
However, it looks like you have no modern Visual C++ headers, that is strange since you have VS2012 (initializer_list header will be added in VS2010 actually).
Today had the same issue, I found that installing the November CTP is not enough, you need to change the platform toolset under project configuration to Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012) to actually use the new features, hope this helps anyone.