C++ Using C# dll - Cannot open .tlh

With TestZ.dll, TestZ.tlb, TestZ.lib, TestZ.exp...

When I write the code below, I get the error "identifier "InitialiserPtr" is undefined". How to define it?

What should I do to fix it, and run the method initialise()?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <string>
#include <windows.h>
#include "tchar.h"
#include "Initialiser.h"

#import "TestZ.tlb" raw_interfaces_only
using namespace TestZ;


int _tmain(int argc, _TCHAR* argv[])
{
	// Initialize COM.
	HRESULT hr = CoInitialize(NULL);

	// Create the interface pointer.
	InitialiserPtr ptr(__uuidof(Initialiser)); //error: identifier "InitialiserPtr" is undefined

	// Call the Add method.
	ptr->initialise();

	CoUninitialize();
	return 0;
}
Last edited on
Topic archived. No new replies allowed.