I am having problems with using a header file called lt360lib.h
My code is as follows
#include <lt360lib.h>
#include <iostream>
using namespace std;
main()
{
}
as you can see it is a simple code just to test if the header file is being accepted or not. but i get the following error
"
e:\program files\microsoft visual studio\vc98\include\lt360lib.h(182) : error C2146: syntax error : missing ';' before identifier 'LT360LIB_LinkedCnt'
e:\program files\microsoft visual studio\vc98\include\lt360lib.h(182) : fatal error C1004: unexpected end of file found
"
all of these errors point to the header file, when i remove "#include <lt360lib.h>" the code compiles with no problems.
Please note i use Microsoft visual C++ 6.0.
This is the header file. i think the problem is with the "LONGINT" return type of the function same too for the "LONGBOOL" types since visual c++ understands "bool" not "LONGBOOL" , also "long int" not "LONGINT".
Also as i searched these types LONGBOOL and LONGINT are used with delphi "pascal language", if this is true is it possible to convert it to normal c++.
BY THE WAY THE HEADER FILE IS LONG SO SKIP THE DEFINITIONS IF YOU WANT AND I TYPED THE FUNCTION WHERE THE PROBLEM STARTS IN BOLD SO IT CAN BE SPOTTED.
Thanks for all
// Header file for Exported Functions in LT360 control library: LT360LIB.DLL
// =========================================================================
// (C)2006 LinearX Systems Inc, Mar-01-2006, Chris N. Strahm
// =========================================================================
// This DLL provides a high level interface for controlling one or more
// LT360 turntables. Up to a maximum of 128 units are managed by the DLL.
//
// NOTE: See the DLL Programming Manual for details on using this interface.
//
// All functions communicate to the LT360 units by numeric index handle.
// Therefore the application program can manage units by keeping track of
// the index handle for each LT360 unit linked.
//
// Linking is provided either through the RS-232 COM ports or the USB bus
// of the PC. The application program can choose which method to attempt
// a link with an LT360.
//
// All strings passed to or from the functions are ASCIIZ strings. It is
// the responsibility of the calling program to allocate the char buffers.
// All functions use the Windows standard calling convention, passing
// parameters from right to left on the stack. The routines cleanup the stack.
// ========================================================================
// ============================================================================
// After the link is established, commands can be sent using a single function,
// LT360LIB_CmdValue. This function takes 3 parameters. Both string and numeric
// parameters are passed using an ASCIIZ string. Return values are passed to
// the same parameter for the Get commands. Commands are selected by using
// different identifier constants as listed below.
// ============================================================================
// ============================================================================
// NOTE: The LT360LIB_WriteBinary and LT360LIB_ReadBinary functions are only
// used by the LT360.EXE Win32 application for updating firmware.
// They are not needed and should not be called by customer applications.
// ============================================================================
#ifndef LT360LIB_H
#define LT360LIB_H
#include <windows.h>
// =========================================================================================
// Identifier Cmd USB COM Data Address Description
// -------------------------- --- --- --- ---- ------- ------------------------------------------
//
// WriteBinary calls
#define lt_EnterRAM 0x11 /* X - 0 11h Enter RAM mode for Flash Programming */
#define lt_ExitRAM 0x12 /* X - 0 12h Exit RAM mode, return to normal op */
#define lt_WriteRamData 0x15 /* X - 32 nnnn Write data to flash buffer */
#define lt_EraseFlash 0x16 /* X - 0 SecNum Erase Flash Sector, by SecNum */
#define lt_RamToFlash 0x17 /* X - 0 RomAdr Copy Buffer RAM to RomAdr */
#define lt_FlashToRam 0x18 /* X - 0 RomAdr Copy from RomAdr to Buffer RAM (1024) */
#define lt_ReBoot 0x19 /* X - 0 19h ReBoot LT360 */
// SetCmd calls
#define lt_Goto_CCW 0x1C /* X X 16 0 Goto by CCW pos str eg. '45.0' '-135.0' */
#define lt_Goto_CW 0x1D /* X X 16 0 Goto by CW pos str eg. '45.0' '-135.0' */
#define lt_Step_CCW 0x1E /* X X 0 0 Step by CCW */
#define lt_Step_CW 0x1F /* X X 0 0 Step by CW */
#define lt_SetSmartTorque 0x20 /* X X 4 0 Set SmartTorque Str: "ON", "OFF" */
#define lt_SetBaudRate 0x21 /* X X 8 0 Set Baudrate Str: "9600" */
#define lt_SetOrigin 0x22 /* X X 0 0 Set current position as origin 0.0 */
#define lt_SetPulseDir 0x23 /* X X 4 0 Set Pulse Dir Str: "CCW", "CW" */
#define lt_SetPulseEdge 0x24 /* X X 4 0 Set Pulse Edge Trigger Str: "RISE", "FALL" */
#define lt_SetStepSize 0x25 /* X X 10 0 Set Degrees per Step Str: "5.0" "0.1" */
#define lt_SetVelocity 0x26 /* X X 10 0 Set Velocity RPM Str: "1.00" "3.00" */
#define lt_SetTorque 0x27 /* X X 10 0 Set Torque % Str: "100.0" "50.0" */
#define lt_SetAccelFunc 0x28 /* X X 2 0 Set Accel Func Num Str: "0" ... "4" */
#define lt_SetName 0x29 /* X X 32 0 Set Unit Name Str: "xxxxxxx" */
#define lt_SetProdDate 0x2A /* X X 12 0 Set Production Date Str: "Jan-15-2005" */
#define lt_SetCalDate 0x2B /* X X 12 0 Set Calibration Date Str: "Jan-15-2005" */
#define lt_SetDueDate 0x2C /* X X 12 0 Set Cal Due Date Str: "Jan-15-2005" */
#define lt_SetBacklash 0x2D /* X X 10 0 Set Backlash, Deg Str: "0.055" */
#define lt_SetMaxTorque 0x2E /* X X 10 0 Set MaxTorque, N*M Str: "43.5" */
#define lt_SetDacNoise 0x2F /* X X 10 0 Set DacNoise, uVrms Str: "21.3" */
#define lt_SetDacVhi 0x30 /* X X 10 0 Set DacVhi, VDC Str: "3.666555" */
#define lt_SetDacVlo 0x31 /* X X 10 0 Set DacVlo, VDC Str: "-1.265768" */
#define lt_SetPulseInput 0x32 /* X X 4 0 Set Pulse Input Str: "OFF" "ON" */
#define lt_SetAnalogInput 0x33 /* X X 4 0 Set Analog Input Str: "OFF" "ON" */
#define lt_SetDisplayPolarity 0x34 /* X X 10 0 Set Display Polarity Str: "UNIPOLAR" "BIPOLAR" */
#define lt_SetInputPolarity 0x35 /* X X 10 0 Set Input Polarity Str: "UNIPOLAR" "BIPOLAR" */
#define lt_SetOutputPolarity 0x36 /* X X 10 0 Set Output Polarity Str: "UNIPOLAR" "BIPOLAR" */
#define lt_SetSerialNumber 0x37 /* X X 10 0 Set Serial Number Str: "712345" */
#define lt_SetMoveAbort 0x38 /* X X 0 0 Set MoveAbort, stops movement */
#define lt_SetMotorHomeChk 0x39 /* X X 4 0 Set Motor Home Check, OFF/ON */
#define lt_SetRevCode 0x3A /* X X 4 0 Set PCB Revision Code, '65'=A */
#define lt_SetOutputMode 0x3B /* X X 6 0 Set OutputMode: 0=CONT, 1=START, 2=STOP */
#define lt_SetDacUnipolarScale 0x40 /* X X 6 0 Set DAC Unipolar Scale Str: "FFFF" (Analog Output) */
#define lt_SetDacUnipolarOffset 0x41 /* X X 6 0 Set DAC Unipolar Offset Str: "FFFF" (Analog Output) */
#define lt_SetDacBipolarScale 0x42 /* X X 6 0 Set DAC Bipolar Scale Str: "FFFF" (Analog Output) */
#define lt_SetDacBipolarOffset 0x43 /* X X 6 0 Set DAC Bipolar Offset Str: "FFFF" (Analog Output) */
#define lt_SetAdcUnipolarScale 0x44 /* X X 6 0 Set ADC Unipolar Scale Str: "FFFF" (Analog Input) */
#define lt_SetAdcUnipolarOffset 0x45 /* X X 6 0 Set ADC Unipolar Offset Str: "FFFF" (Analog Input) */
#define lt_SetAdcBipolarScale 0x46 /* X X 6 0 Set ADC Bipolar Scale Str: "FFFF" (Analog Input) */
#define lt_SetAdcBipolarOffset 0x47 /* X X 6 0 Set ADC Bipolar Offset Str: "FFFF" (Analog Input) */
#define lt_SetDacUniErrorValue 0x48 /* X X 16 0 Set DAC Unipolar Error Value nnn at index:[0..255] Str: "nnn NNN" */
#define lt_SetDacBipErrorValue 0x49 /* X X 16 0 Set DAC Bipolar Error Value nnn at index:[0..255] Str: "nnn NNN" */
#define lt_SetZeroDacUniError 0x4A /* X X 0 0 Set Zero's the DAC Unipolar Error Array */
#define lt_SetZeroDacBipError 0x4B /* X X 0 0 Set Zero's the DAC Unipolar Error Array */
#define lt_SetCalMode 0x4C /* X X 4 0 Set Calibration Mode Str: "OFF" "ON" */
#define lt_SetDacPosition 0x4D /* X X 8 0 Set DAC position in Microsteps [0..115200-1] str: "nnnnnn" */
#define lt_SetDacDirect 0x4E /* X X 8 0 Set DAC value directly [0..65535] str: "nnnnn" */
#define lt_SetDacCorrect 0x4F /* X X 4 0 Set DAC Correction Str: "OFF" "ON" */
#define lt_SetDebug 0x70 /* X X 4 0 Set Special Debug mode or command */
#define lt_SetWriteRead 0x7F /* X 32 CmdID Set WriteRead for RS232, adrcmd for read */
// ReadBinary calls
#define lt_ReadRamData 0x90 /* X - 32 nnnn Read data from flash buffer at Adr (1024) */
// GetCmd calls
#define lt_GetName 0x91 /* X X 32 0 Get NAME str */
#define lt_GetTitle 0x92 /* X X 25 0 Get TITLE str "LT360 Precision Turntable" */
#define lt_GetAuthor 0x93 /* X X 15 0 Get AUTHOR str "Chris N. Strahm" */
#define lt_GetCopyright 0x94 /* X X 28 0 Get COPYRIGHT str "(C)2005 LinearX Systems Inc" */
#define lt_GetVerCode 0x95 /* X X 12 0 Get VerCode str "1.00" */
#define lt_GetVerDate 0x96 /* X X 12 0 Get VerDate str "JAN-01-2005" */
#define lt_GetProdDate 0x97 /* X X 12 0 Get ProductionDate str "JAN-01-2005" */
#define lt_GetCalDate 0x98 /* X X 12 0 Get CalibrationDate str "JAN-01-2005" */
#define lt_GetDueDate 0x99 /* X X 12 0 Get Calibration Due Date str "JAN-01-2005" */
#define lt_GetSerialNumber 0x9A /* X X 10 0 Get SerialNumber str "700001" */
#define lt_GetBaudRate 0x9B /* X X 10 0 Get BaudRate str "9600", "19200" */
#define lt_GetPosition 0x9C /* X X 10 0 Get Position str "15.0", "-45.0" */
#define lt_GetPulseDir 0x9D /* X X 4 0 Get Pulse Dir str "CCW", "CW" */
#define lt_GetPulseEdge 0x9E /* X X 4 0 Get Pulse trigger Edge str "RISE", "FALL" */
#define lt_GetStepSize 0x9F /* X X 10 0 Get Step Size str "5.0", "0.1" */
#define lt_GetVelocity 0xA0 /* X X 10 0 Get Velocity, RPM str "1.0", "0.1" */
#define lt_GetTorque 0xA1 /* X X 10 0 Get Torque, % str "100.0", "50.0" */
#define lt_GetAccelFunc 0xA2 /* X X 2 0 Get Accel Func str "0", "1" .. "3" number */
#define lt_GetMoving 0xA3 /* X X 4 0 Get Moving Cond str "CCW", "NO", "CW" */
#define lt_GetBacklash 0xA4 /* X X 10 0 Get Backlash, +/-Deg "0.055" */
#define lt_GetMaxTorque 0xA5 /* X X 10 0 Get MaxTorque, N*M "43.5" */
#define lt_GetDacNoise 0xA6 /* X X 10 0 Get DacNoise, uVrms "21.5" */
#define lt_GetDacVhi 0xA7 /* X X 10 0 Get DacVhi, VDC "3.666555" */
#define lt_GetDacVlo 0xA8 /* X X 10 0 Get DacVlo, VDC "-1.2666555" */
#define lt_GetPulseInput 0xA9 /* X X 4 0 Get Pulse Input Status: "OFF" "ON" */
#define lt_GetAnalogInput 0xAA /* X X 4 0 Get Analog Input Status: "OFF" "ON" */
#define lt_GetSmartTorque 0xAB /* X X 4 0 Get Smart Torque Status: "OFF" "ON" */
#define lt_GetDisplayPolarity 0xAC /* X X 10 0 Get Display Polarity Status: "BIPOLAR" "UNIPOLAR" */
#define lt_GetInputPolarity 0xAD /* X X 10 0 Get Input Polarity Status: "BIPOLAR" "UNIPOLAR" */
#define lt_GetOutputPolarity 0xAE /* X X 10 0 Get Output Polarity Status: "BIPOLAR" "UNIPOLAR" */
#define lt_GetCalMode 0xAF /* X X 6 0 Get Cal Mode: "OFF" "ON" */
#define lt_GetDacUnipolarScale 0xB0 /* X X 6 0 Get DAC Unipolar Scale Hex Value: "FFFF" */
#define lt_GetDacUnipolarOffset 0xB1 /* X X 6 0 Get DAC Unipolar Offset Hex Value: "FFFF" */
#define lt_GetDacBipolarScale 0xB2 /* X X 6 0 Get DAC Bipolar Scale Hex Value: "FFFF" */
#define lt_GetDacBipolarOffset 0xB3 /* X X 6 0 Get DAC Bipolar Offset Hex Value: "FFFF" */
#define lt_GetAdcUnipolarScale 0xB4 /* X X 6 0 Get Adc Unipolar Scale Hex Value: "FFFF" */
#define lt_GetAdcUnipolarOffset 0xB5 /* X X 6 0 Get ADC Unipolar Offset Hex Value: "FFFF" */
#define lt_GetAdcBipolarScale 0xB6 /* X X 6 0 Get ADC Bipolar Scale Hex Value: "FFFF" */
#define lt_GetAdcBipolarOffset 0xB7 /* X X 6 0 Get ADC Bipolar Offset Hex Value: "FFFF" */
#define lt_GetAdcPosition 0xB8 /* X X 10 0 Get ADC Position in Microsteps:: "0..115200-1" (analog input) (cal) */
#define lt_GetAdcVolt 0xB9 /* X X 10 0 Get ADC voltage: 1.23345 (analog input) */
#define lt_GetAdcValue 0xBA /* X X 10 0 Get ADC Value : 0..65535 (analog input) */
#define lt_GetDacCorrect 0xBB /* X X 4 0 Get DAC Correction Status: "OFF" "ON" */
#define lt_GetDacDirect 0xBC /* X X 6 0 Get DAC value: "0..65535" */
#define lt_GetDacUniErrFunc 0xBD /* X X 4 0 Get DAC Unipolar Error value at current position: "nnn" (cal) */
#define lt_GetDacBipErrFunc 0xBE /* X X 4 0 Get DAC Bipolar Error value at current position: "nnn" (cal) */
#define lt_GetDacUniErrValue 0xBF /* X X 4 0 Get DAC Unipolar Error value at index [0..180]: "nnn" (cal) */
#define lt_GetDacBipErrValue 0xC0 /* X X 4 0 Get DAC Bipolar Error value at index [0..180]: "nnn" (cal) */
#define lt_GetMotorHomeChk 0xC1 /* X X 4 0 Get Motor Home Checking Status: "OFF" "ON" */
#define lt_GetRevCode 0xC2 /* X X 4 0 Get PCB Revision Code, '65'=A */
#define lt_GetOutputMode 0xC3 /* X X 6 0 Get OutputMode: 0=CONT, 1=START, 2=STOP */
#define lt_GetFlashBootLoader 0xD0 /* X X 6 0 Get Flash Bootloader Version str: "1.52" "1.30", LPC2104 */
#define lt_GetFlashPartID 0xD1 /* X X 12 0 Get Flash Part ID str: "4293984018" */
#define lt_GetReadStr 0xF0 /* X 32 0 Get usb str from previous WriteRead from RS232 calls */
// ----------------------- --- --- --- ---- ------- ------------------------------------------
// NOTE: All functions use Standard Calling Convention
//---------------------------------------------------------------------------
// Function: LT360LIB_GetDllVersion
// Abstract: Returns the Version and Date strings of the DLL
// Parameters: returns ver & date strs eg: nnn.nnn.nnn.nnn , Oct/11/1998
// Returns: None
//---------------------------------------------------------------------------
extern void LT360LIB_GetDllVerDate(char *Ver, char *Date);
//---------------------------------------------------------------------------
// Function: LT360LIB_LinkedCnt
// Abstract: Returns the number of LT360 with active links (0..128)
// Parameters: None
// Returns: Number of LT360 units with active links via USB or RS-232
//---------------------------------------------------------------------------
[B]extern LONGINT LT360LIB_LinkedCnt(void);[/B]
//---------------------------------------------------------------------------
// Function: LT360LIB_OpenLinkUSB
// Abstract: Attempts to find and link one LT360 over the USB bus.
// Since more than one LT360 may be on the USB bus,
// this routine can be called repeatly until all of
// the LT360 units on the USB bus are found (return=0).
// Parameters: None
// Returns: LT360_Index > 0 if found, else 0 if no LT360 found.
//---------------------------------------------------------------------------
extern LONGINT LT360LIB_OpenLinkUSB(void);
//---------------------------------------------------------------------------
// Function: LT360LIB_OpenLinkCOM
// Abstract: Attempts to find and link one LT360 over an RS-232 port.
// Since only one LT360 can be on a single COM port,
// this routine is called using different COM ports (1,2,3,4..)
// for each LT360 unit to be linked. If not found, return=0.
// Note: The BaudRate here must match what the LT360 is using.
// The LT360 uses 9600 by default unless it has been changed.
// Parameters: ComNum (1,2,3,4...) , BaudRate (9600, 19200, etc)
// Returns: Handle > 0 if found, else 0 if no LT360 found.
//---------------------------------------------------------------------------
extern LONGINT LT360LIB_OpenLinkCOM(LONGINT ComNum, LONGINT BaudRate);
//---------------------------------------------------------------------------
// Function: LT360LIB_CloseLink
// Abstract: Closes/Unlinks the LT360 given by index number (RS232 or USB)
// Parameters: LT360_Index (1..LinkedCnt)
// Returns: Returns TRUE if link closed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_CloseLink(LONGINT Handle);
//---------------------------------------------------------------------------
// Function: LT360LIB_GetUsbFirmwareVerDate
// Abstract: Obtains the strings for the Version and Date of the USB
// controller firmware inside the LT360.
// The LT360 given by the index number must have USB link.
// Parameters: LT360_Index, ptrs for Version and Date strings
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_GetUsbFirmwareVerDate(LONGINT LT360_Index, char *UsbFirmwareRev, char *UsbFirmwareDate);
//---------------------------------------------------------------------------
// Function: LT360LIB_Cmd
// Abstract: Sends a Command to the LT360
// Also dislays error message dialog if command fails
// Parameters: Handle: LT360 Index returned from Link
// CmdID : Command Identifier
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_Cmd(LONGINT Handle, LONGINT CmdID);
//---------------------------------------------------------------------------
// Function: LT360LIB_CmdValue
// Abstract: Sends a Command to the LT360
// Also dislays error message dialog if command fails
// Parameters: Handle: LT360 Index returned from Link
// CmdID : Command Identifier
// ParamValue : Parameter String for Value, may be nil
// Get calls return strings in ParamValue
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_CmdValue(LONGINT Handle, LONGINT CmdID, char *ParamValue);
//---------------------------------------------------------------------------
// Function: LT360LIB_CmdIndexValue
// Abstract: Sends a Command to the LT360
// Also dislays error message dialog if command fails
// Parameters: Handle: LT360 Index returned from Link
// CmdID : Command Identifier
// ParamIndex : Parameter String for Index, may be nil
// ParamValue : Parameter String for Value, may be nil
// Get calls return strings in ParamValue
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_CmdIndexValue(LONGINT Handle, LONGINT CmdID, char *ParamIndex, char *ParamValue);
//---------------------------------------------------------------------------
// Function: LT360LIB_CmdString
// Abstract: Returns the Cmd str used for COM port calls.
// Parameters: CmdID
// Returns: Returns command str if executed successfully, empty if bad CmdIndex
//---------------------------------------------------------------------------
extern char *LT360LIB_CmdString(LONGINT CmdID);
//---------------------------------------------------------------------------
// Function: LT360LIB_WriteBinary
// Abstract: USB binary data write command.
// P is a pointer to the data array to be written.
// Maximum DataByteCnt=32, Adr depends on command
// Parameters: LT360_Index, CmdIndex, DataByteCnt, Adr
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_WriteBinary(LONGINT Handle, LONGINT CmdIndex, LONGINT DataByteCnt, LONGINT Adr, Pointer P);
//---------------------------------------------------------------------------
// Function: LT360LIB_ReadBinary
// Abstract: USB binary data read command.
// P is a pointer to the data array to be returned.
// Maximum DataByteCnt=32, Adr depends on command
// Parameters: LT360_Index, CmdIndex, DataByteCnt, Adr
// Returns: Returns TRUE if executed successfully
//---------------------------------------------------------------------------
extern LONGBOOL LT360LIB_ReadBinary(LONGINT Handle, LONGINT CmdIndex, LONGINT DataByteCnt, LONGINT Adr, Pointer P);
/*
Function LT360LIB_GetDllVerDate; External 'LT360LIB.DLL' Index 01;
Function LT360LIB_LinkedCnt; External 'LT360LIB.DLL' Index 02;
Function LT360LIB_CloseLink; External 'LT360LIB.DLL' Index 03;
Function LT360LIB_OpenLinkUSB; External 'LT360LIB.DLL' Index 04;
Function LT360LIB_OpenLinkCOM; External 'LT360LIB.DLL' Index 05;
Function LT360LIB_GetUsbFirmwareVerDate; External 'LT360LIB.DLL' Index 06;
Function LT360LIB_Cmd; External 'LT360LIB.DLL' Index 07;
Function LT360LIB_CmdValue; External 'LT360LIB.DLL' Index 08;
Function LT360LIB_CmdIndexValue; External 'LT360LIB.DLL' Index 09;
Function LT360LIB_CmdString; External 'LT360LIB.DLL' Index 10;
Function LT360LIB_WriteBinary; External 'LT360LIB.DLL' Index 11;
Function LT360LIB_ReadBinary; External 'LT360LIB.DLL' Index 12;
*/
#endif // LT360LIB_H