DLL problems

I not 100% sure if this is a beginner problem, but I know I'm close to fixing I just can't see it or don't know enough about C++ yet. I'm working on a project and I'm using Unity (a game building program) and the Xbox Kinect (motion tracker & etc.). In order to get Unity and the Kinect to talk to each other I've been following a tutorial I found @ http://www.polyfactor.com/ (webpage is in spanish but can be translated by Google chrome) I was working on 2.2 part of the tutorial and when I got to the end I keep getting errors on line 11, 16 and 17. Code is below and as well as the error line I'm getting.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
KinectUnityPlugin.h (the header file)
Description: DLL Class Principal
 */

#pragma once

#include "stdafx.h"
#include <string>

#ifndef KINECTUNITYPLUGIN_API
     #define KINECTUNITYPLUGIN_API extern "C"__declspec(dllexport)
#endif


 // Test
 KINECTUNITYPLUGIN_API int GetANumber ();
 KINECTUNITYPLUGIN_API char* GetAString ();


kinectunityplugin.h(11): warning C4005: 'KINECTUNITYPLUGIN_API' : macro redefinition

kintunityplugin.h(11) : see previous definition of 'KINECTUNITYPLUGIN_API'

kinectunityplugin.h(16): error C2146: syntax error : missing ';' before identifier 'declspec'

kinectunityplugin.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

kinectunityplugin.h(16): error C2065: 'dllexport' : undeclared identifier

kinectunityplugin.h(16): error C2448: 'declspec' : function-style initializer appears to be a function definition

kinectunityplugin.h(17): error C2146: syntax error : missing ';' before identifier 'declspec'

kinectunityplugin.h(17): error C2065: 'dllexport' : undeclared identifier

kinectunityplugin.h(17): error C2448: 'declspec' : function-style initializer appears to be a function definition

----------------------------------------------------------

Next is the other part of the code I wrote for the DLL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 description: Defines the exported functions for the DLL application.
*/

#include "stdafx.h"
#include "KinectUnityPlugin.h" // DLL export declarations
 
// Examples
int  GetANumber ()
{
    return  1;
}
 
char* GetAString ()
{
    char* lsTemp = "Hello World";
 
    return  lsTemp;
}


If anyone see the problem please let me know cause I'm stuck on this part, Thank you.
Last edited on
Topic archived. No new replies allowed.