LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

add __MSC_VER macro

Dear CVI Users -
 
I have third party hardware, driver and example C/C++/C#, VB and Python code.  I tried to create a CVI application (a basic .uir with a quitcallback) and added the .c, .h and .dll files to the project.  When I run the debug project, I get the error window:
 
Include file "stdint.h" was not found. Do you want to look for it? 
 
I read that its for C99-compliant compiler (GCC), but that's not what I want ... right?  Below is the origin of the error from the 3rd party .h file...
 
#ifndef _MSC_VER
/* C99-compliant compilers (GCC) */
#include <stdint.h>
typedef uint8_t   u08;
:
:
typedef int64_t   s64;
#else
/* Microsoft compilers (Visual C++) */
typedef unsigned __int8   u08;
:
:
typedef signed   __int64  s64;
#endif /* __MSC_VER */
 
Since CVI does not define _MSC_VER, how do manually define the _MSC_VER macro to fit the above code?
 
Thanks,
Matt
 
0 Kudos
Message 1 of 11
(5,719 Views)
Hello Matthew,
 
It looks like we have a KnowledgeBase Article here that gives you more information about this issue, #define _MSC_VER should do it for you. Please let me know if this does not answer your question.
With warm regards,

David D.
0 Kudos
Message 2 of 11
(5,695 Views)
Hello David and Fellow-CVI-users,
 
Still have no success; I need to know where to insert the code and exactly how it should read.  I tried both
 
#ifndef _MSC_VER
#define _MSC_VER
#endif
 
and
 
#ifndef _MSC_VER
#define _MSC_VER
#define /MSC_VER 1200
#endif
 
at the top of the .c file with main() = Same Errors. 
 
SUMMARY: When somebody declares MSC_VER, where and how is it done? 
 
Thank you,
Matthew
0 Kudos
Message 3 of 11
(5,688 Views)
Hello Matthew,
 
Did you try #define _MSC_VER <version>
 
Where <version> is the number corresponding to the version you are using as mentioned in the link I provided earlier.
With warm regards,

David D.
0 Kudos
Message 4 of 11
(5,681 Views)
Hello Matthew,

I see that you said you defined _MSC_VER at the top of the .c file with the main function, but most importantly, did you define it *before* you #include the third party header file you referred to?  Perhaps the best way to make sure you have defined it in the appropriate place would be to do the #define in the third party header file, before the definition of _MSC_VER is checked.

NickB
National Instruments
0 Kudos
Message 5 of 11
(5,661 Views)

Hi

I added #define _MSC_VER 1300 to the top of the header before it checked which compilier.  Then it jumps into the microsoft types, where  unsigned __int8 is not known because I get

  "aardvark.h"(81,27)   syntax error; found 'identifier' expecting ';'.

#ifndef _MSC_VER
/* C99-compliant compilers (GCC) */
#include <stdint.h>
typedef uint8_t   u08;
:
:
typedef int64_t   s64;
#else
/* Microsoft compilers (Visual C++) */
typedef unsigned __int8   u08;
:
:
typedef signed   __int64  s64;
#endif /* __MSC_VER */
 
Is there a way microsoft types are known?  (i.e. there will not be complaints for unsigned __int8)
 
Your input is greatly appreciated.
 
Thanks
Matt
0 Kudos
Message 6 of 11
(5,648 Views)

Looks like you will need to provide your own typedefs, matching up the third party definitions with the CVI ones, available here.

 

JR

0 Kudos
Message 7 of 11
(5,636 Views)

It is clear now. 

Thanks!

0 Kudos
Message 8 of 11
(5,628 Views)

Matt,

Did you ever solve this problem ?  I am having the same exact problem with the same exact header file /hardware.

 

Thanks

Diego

0 Kudos
Message 9 of 11
(5,280 Views)

Hi Spidyman

 

I modified the .h file as you see below in the first example.  Or a more simple way is to remove the #ifndef _MSC_VER ... statements as you see in the second example below.

 

//-----------------------

//  first example

//------------------------

// 
//  Not using GCC or Microsoft compilers

#ifndef _MSC_VER
/* C99-compliant compilers (GCC) */
//#include <stdint.h>
/*typedef uint8_t   u08;*/ typedef unsigned char    u08;
/*typedef uint16_t  u16;*/ typedef unsigned short  u16;
/*typedef uint32_t  u32;*/ typedef unsigned int  u32;
/*typedef uint64_t  u64;*/ typedef unsigned __int64   u64;
/*typedef int8_t    s08;*/  typedef char    s08;
/*typedef int16_t   s16;*/ typedef short      s16;
/*typedef int32_t   s32;*/ typedef int     s32;
/*typedef int64_t   s64;*/ typedef __int64     s64;

#else
/* Microsoft compilers (Visual C++) */
typedef unsigned __int8   u08;
typedef unsigned __int16  u16;
typedef unsigned __int32  u32;
typedef unsigned __int64  u64;
typedef signed   __int8   s08;
typedef signed   __int16  s16;
typedef signed   __int32  s32;
typedef signed   __int64  s64;

#endif /* __MSC_VER */

 

 

//-----------------------

//  second example

//------------------------

//

//#ifndef _MSC_VER
/* C99-compliant compilers (GCC) */
//#include <stdint.h>
//typedef uint8_t   u08;
//typedef uint16_t  u16;
//typedef uint32_t  u32;
//typedef uint64_t  u64;
//typedef int8_t    s08;
//typedef int16_t   s16;
//typedef int32_t   s32;
//typedef int64_t   s64;

//#else
/* Microsoft compilers (Visual C++) */
typedef unsigned char   u08;
typedef unsigned short  u16;
typedef unsigned int    u32;
typedef unsigned long   u64;
typedef signed   char   s08;
typedef signed   short  s16;
typedef signed   int    s32;
typedef signed   long   s64;

//#endif /* __MSC_VER */

 

Message 10 of 11
(5,251 Views)