error MIDL2025 : syntax error : expecting an interface - c++

I am compiling quite an old code using MS Studio 8 and getting quite an annoying error:
error MIDL2025 : syntax error : expecting an interface name or DispatchInterfaceName or CoclassName or ModuleName or LibraryName or a type specification near "exception".
It is an *.idl:
#ifndef __UserCORBAException_IDL__
#define __UserCORBAException_IDL__
exception UserCORBAException {
string xml;
};
#endif//__UserCORBAException_IDL__
It compiles using Studio 6.

It looks like you are compiling CORBA IDL with the Microsoft IDL compiler. They are separate languages, they just use the same file extension.
I assume you are importing an existing project, and you have accepted the suggested tool to compile the file, however it is the wrong tool.
You need to use the CORBA IDL compiler.

Related

Visual Studio C++ NPAPI plugin with Twain support

I want to make a Google Chrome plugin that use Twain to remote control a Digital Camera.
I want this to run on Windows and I'm using Visual Studio Express 2012 C++.
I have this sample for NPAPI and this sample of CppWrapper for Twain which has 3 interesting files (TwainCpp.cpp TwainCpp.h twain.h)
Before doing anything, I want to merge these two projects.
First step: putting twain.h in the npsimple project which failed, twain.h errors caught.
Second step: putting CppTwain in npsimple, which also failed because twain.h "contains" errors.
Problem is that when I create an empty project, and put twain.h in it, there is no error! So I tried to put npsimple files in that empty project, and this time I get error from npsimple files..
Error type :
I have this code in twain.h :
#ifdef _MSWIN_
typedef HANDLE TW_HANDLE;
typedef LPVOID TW_MEMREF;
and I get plenty of errors like :
error C2146: syntax error : missing ';' before identifier 'TW_HANDLE'
How can I merge these projects?
HANDLE is an unspecified type because you don't include anything that is specificing it. You'll want to include windows.h.
Obviously there is no error when you add only the twain.h header file to the empty project - you haven't added any sources to compile, hence there can be no compilation errors.

Compiling swig extension with COLeDateTime for python

I have a fairly extensive C++ project that I am using. Just for kicks, I thought I would try the very simple example of swig which uses just the header from the project to build a python module.
Swig ran properly and created a project_wrap.cxx file. However, when I try to compile and link that file with the rest of my project, I am running into errors:
It seems they are mostly related to the MS COLeDateTime:
Error 14 error C2061: syntax error : identifier 'COleDateTime'
resulting from declarations such as:
void SetStartTime (COleDateTime dt ) {m_simstart_time = dt; }
Or from IntelliSense:
194 IntelliSense: identifier "COleDateTime" is undefined
I presume the workaround is to work with the windows.i file, but does anyone have some tips/experience/examples for this?
Add
%{
#include "the_coledatetime_header.h" // whatever the header is
%}
to your .i
The #include will be added to you project_wrap.cxx & should compile.
Check http://www.swig.org/Doc2.0/SWIGDocumentation.html#Preprocessor_delimiters for more info.

"wchar.h" gives syntax errors when imported in an .idl file (COM server)

I created a new C++ (ATL) project in my visual studio and set off on creating a nice little COM server dll. There is, of course an IDL file that defines interface outwards for the world to use. Since I'm using another library in this project I have the need to use wchar_t type. But when I put:
import "wchar.h";
on the top of my .idl file all hell breaks loose. Ok, I exaggerate. A little error pops up:
error MIDL2025: syntax error : expecting ; near "{" d:\programs\tools\dotnet\Microsoft Visual Studio 10.0\VC\include\wchar.h 994
Since this is an error with a system header file I have no idea how to rectify this problem.
Any ideas?

error PRJ0019: A tool returned an error code from "moc'ing qt/gui/QFloatSlider.h

I'm building a big C++ project on Visual Studio 2008 I'm getting this error message and I don't understand it. Is it a failure to include the .h file?
I know this thread is dated, but I had the exact same problem with a C++ project on Visual Studio 2008, here was my resolution...
One of the things the VS2008 compile told me was that it generated a log on:
"file://C:\Documents and Settings\adam\My Documents\Visual Studio 2008\Projects\MyProject\Debug\BuildLog.htm"
This log demystified the problem for me.
In my case, it had the following explicit error message:
c:\Documents and Settings\adam\My Documents\Visual Studio 2008\Projects\MyProject\MyProject\UnitTests.h(36): Error: Meta object features not supported for nested classes
The problem had been that INSIDE the class I defined here, I defined yet another internal (nested) class, that included the QT macro (so I could define signals and slots):
Q_OBJECT
Obviously QT wasn't happy that this class was nested/internal in another class. So I simply moved the class definition outside (IE made it non-internal).
No, it is not.
Did you look up the error code error PRJ0019.

iphlpapi / ifdef.h

I'm trying to use iphlpapi (GetAdapterInfo) and am having trouble compiling the code. I have iphlpapi.h from SDK 7 and have added the appropriate path to the include files in visual studio.
I get the following error...
c:\program files\microsoft sdks\windows\v7.0\include\ifdef.h(154) : error C2146: syntax error : missing ';' before identifier 'NET_IFTYPE'
The lines in ifdef where this occurs are shown below.
typedef NET_LUID IF_LUID, *PIF_LUID;
typedef ULONG NET_IFINDEX, *PNET_IFINDEX; // Interface Index (ifIndex)
typedef UINT16 NET_IFTYPE, *PNET_IFTYPE; // Interface Type (IANA ifType)
I finally figured out how to get this to work so I'm putting this here for others who might stumble upon it.
First, I'm using visual c++ version 6.0 with the 2003 sdk. I added the sdk as the first choice using TOOLS->OPTIONS->DIRECTORIES. Adding the include winsock2.h caused about 60 redefinition errors. I found several sources telling me that the winsock2 include had to precede the windows.h include. My windows.h include was generated for me by VC++ in the precompiled header stdafx.h so I moved the winsock2.h include there. I now can compile and run my program!
According to this page, it looks as though you might need to make sure winsock2.h is included first. I'm guessing that it defines some of those types.
Also, the MSDN page for NET_LUID says it requires Vista at a minimum. Make sure that's true.