LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

REDEFINATION OF MACRO

Hi,
    I m currently working on a project using labwindows that acquires data from headtracker (ascension technologies) via the serial port.  I have downloaded the windows drivers for the headtracker from their website which contain 3 files(bird.dll,bird.h,bird.lib). Using the help file provided by ascension technology i have designed a system that acuires data using labwindows.
 
I have saved the bird.dll under bin in CVI180,
I have saved the bird.lib under msvc in bin and also in extlib.
I have saved the bird.h under  include
 
However upon compling i get the following error
 NEW.c - 20 errors
  "Bird.h"(292,50)   Redefinition of macro 'DLLEXPORT'.
  "Bird.h"(551,16)   syntax error; found 'identifier' expecting ';'.
  "Bird.h"(608,16)   syntax error; found 'identifier' expecting ';'.
 
 and many more similar syntax errors.
 
The line where the macro is defined is :
// Macro for DLL export functions
#define DLLEXPORT __declspec(dllexport) __cdecl
 
I feel the first error is what is leading to all the other syntax errors either bcoz i have not placed a file in the correct folder or some other issue..
 
I have attached a copy of my header file(bird.h).
 
Can u please suggest me something.
 
Waiting for your reply
Kunal Chaniary
 
0 Kudos
Message 1 of 3
(3,399 Views)

Since they are application specific, you would be better advised to put the three bird.* files in your application (project) directory.

DLLEXPORT is defined in cvidef.h, which is partly where your problem lies. There is another problem as well, which is that since your application is using the DLL, the functions should not be declared as DLLEXPORT at all.

You will have to modify the bird.h file to get around this problem.

Replace the line

#define DLLEXPORT __declspec(dllexport) __cdecl

With the following two lines:

#undef DLLEXPORT
#define DLLEXPORT __declspec(dllimport) __cdecl

Note that 'dllimport' replaces 'dllexport'.

--
Martin
Certified CVI Developer
0 Kudos
Message 2 of 3
(3,376 Views)
The order of the include files in your main application file is very important. Adding the mentioned files at the bottom of the included might resolve the issue.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 3 of 3
(3,330 Views)