Bonjour,
Voila j'ai un problème a la compilation d'une de mes class dans mon projet. Il ne reconnaît pas la déclaration suivante : void CALLBACK EXPORT OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT *pVar, FILETIME timestamp, DWORD quality).
Bref voila mon code. En un le .cpp
le .h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "OPC.h" OPC::OPC(void) { dialogue = new Dialogue(); } OPC::~OPC(void) { DisconnectOPC(ConnectionHandle); } void CALLBACK EXPORT OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT *pVar, FILETIME timestamp, DWORD quality)//ce qui me pose problème. { } ... void OPC::Add_group() { rate = 0; deadband = 0.0f; GroupHandle = AddOPCGroup (ConnectionHandle, "Group 1", &rate, &deadband); EnableOPCNotification (ConnectionHandle, OPCUpdateCallback);//ce qui "appel" ma fonction. }
et maintenant le .h ou est définie la fonction qui me pose problème (ce n'est pas moi qui l'ai codé-> acheté donc sa doit fonctionner)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #ifndef OPC_H #define OPC_H #pragma once #include "opcda.h" #include "opc_ae.h" #include "WTclientAPI.h" #include "wtclientapiex.h" #include "Dialogue.h" class OPC { public: OPC(void); ~OPC(void); private: class Dialogue *dialogue; HANDLE ConnectionHandle; int nombre; char* Nom_serveur; DWORD rate; float deadband; HANDLE GroupHandle; HANDLE ItemHandle; NOTIFYPROCAPI OPCUpdateCallback;//déclaration mais pas compris pourquoi elle soit être la!! void Add_group(); }; #endif // OPC_H
Et finalement voila les erreurs que j'obtients :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Callback Definitions // // Used by the DLL to pass control back to the Client Application // Each callback must be explicitly enabled by calling one of the following // exported API functions: // EnableOPCNotification (HANDLE hConnect, NOTIFYPROCAPI lpCallback); ... NOTIFYPROCAPI // Signals the application when data has been updated by the server // prototype for the callback function is as follows: // void CALLBACK EXPORT OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT *pVar, FILETIME timestamp, DWORD quality) .... #ifdef STRICT typedef VOID (CALLBACK* NOTIFYPROCAPI)(HANDLE, HANDLE, VARIANT*, FILETIME, DWORD); ... ...
Voila si quelqu'un a une idée sur comment corriger cela. En tout cas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Error 1 error C2146: syntax error : missing ';' before identifier 'OPCUpdateCallback' c:\Sylvain\Polux_application\Polux_application\OPC.cpp 11 Error 3 error C2182: 'EXPORT' : illegal use of type 'void' c:\Sylvain\Polux_application\Polux_application\OPC.cpp 11 Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\Sylvain\Polux_application\Polux_application\OPC.cpp 12 Warning 2 warning C4229: anachronism used : modifiers on data are ignored c:\Sylvain\Polux_application\Polux_application\OPC.cpp 11 Warning 5 warning C4508: 'OPCUpdateCallback' : function should return a value; 'void' return type assumed c:\Sylvain\Polux_application\Polux_application\OPC.cpp 14d'avance.
Partager