Hallo Leute,
ich habe das verzwickte Problem, dass ich einer Funktion ein Array von
Structs übergeben will, aber leider nicht weis wie.
Die Fehlermeldung lautet:
Type error in argument 1 to 'Init_CAN_Device'; "found 'pointer to struct
CAN_Bus_Structure' expected 'pointer to incomplete struct
CAN_Bus_Structure'
1 | // Deklarationen
|
2 | int Init_CAN_Device(struct CAN_Bus_Structure *CAN_Bus);
|
3 |
|
4 | struct CAN_Bus_Structure
|
5 | {
|
6 | long Handle;
|
7 | unsigned long gChannelMask;
|
8 | unsigned int Bus_No;
|
9 | unsigned int Status;
|
10 | unsigned int BaudRate;
|
11 | unsigned int TraceCounter;
|
12 | };
|
13 |
|
14 | // Array von Structs erstellen
|
15 | struct CAN_Bus_Structure CAN_Bus[MAX_CAN_BUS_NO];
|
16 |
|
17 | //Prototyp
|
18 | int Init_CAN_Device(struct CAN_Bus_Structure *CAN_Bus)
|
19 | {
|
20 | Vstatus vErr;
|
21 | int i, ChIndex= 0;
|
22 | int AC2_Channel_found = 0, CANCASEXL_Channel_found = 0;
|
23 | // ... CODE
|
24 | CAN_Bus[i].Handle = INVALID_PORTHANDLE;
|
25 | //..... noch viel code
|
26 | if ( AC2_Channel_found >= 2 || CANCASEXL_Channel_found >= 2)
|
27 | return OK;
|
28 | else
|
29 | return NOK;
|
30 | }
|
31 |
|
32 | // main()
|
33 | int main (int argc, char *argv[])
|
34 | {
|
35 | // ... CODE
|
36 | Init_CAN_Device(CAN_Bus); // HIER KOMMT DER FEHLER!!!
|
37 |
|
38 | //..... noch viel code
|
39 | }
|
Wer weis Rat?
Wie übergebe ich die Referenz richtig?
Probiert habe ich:
Init_CAN_Device(CAN_Bus);
Init_CAN_Device(&CAN_Bus);
Init_CAN_Device(CAN_Bus[]);
....
nicht ging.
Kann mir jemand weiterhelfen?
Grüße,
Alfred