PCAN Write cannot convert TPCANMsg
Posted: Thu 27. Jul 2023, 14:32
peak driver 8.16.0
PCAN-Basic_Linux 4.7.0.3
Hardware: PCAN USB IPEH-002022
Hey,
im currently learning to work with CAN Bus and wanted to try the CAN Write function provided in the PCAN Basic doc. While compiling I got the error message:
PCAN-Basic_Linux 4.7.0.3
Hardware: PCAN USB IPEH-002022
Hey,
im currently learning to work with CAN Bus and wanted to try the CAN Write function provided in the PCAN Basic doc. While compiling I got the error message:
I added my c++ code below, any help would be appreciated :)can_send_test.cpp:30:38: error: cannot convert ‘TPCANMsg’ {aka ‘tagTPCANMsg’} to ‘TPCANMsg*’ {aka ‘tagTPCANMsg*’}
30 | result = CAN_Write(PCAN_USBBUS1, msg);
Code: Select all
#include<iostream>
#include<PCANBasic.h>
#include <asm/types.h>
#define DWORD __u32
#define WORD unsigned short
#define BYTE unsigned char
#define LPSTR char*
int main() {
TPCANMsg msg;
TPCANStatus result;
char strMsg[256];
// Konfigurieren einer CAN Nachricht
//
msg.ID = 895;
msg.MSGTYPE = PCAN_MESSAGE_STANDARD;
msg.LEN = 4;
msg.DATA[0] = 0xFF;
msg.DATA[1] = 0x00;
msg.DATA[2] = 0x00;
msg.DATA[3] = 0x00;
// Die Nachricht wird über den PCAN-USB Kanal-1 gesendet.
//
result = CAN_Write(PCAN_USBBUS1, msg);
return 0;
}