William23668 8 Posted August 29 Hi I was compiling a component and got this error [DCC Error] Winapi.Windows.pas(1404): E2003 Undeclared identifier: '_CONTEXT' Code: TContext = _CONTEXT; CONTEXT = _CONTEXT; {$EXTERNALSYM CONTEXT} Why I get this error ? Share this post Link to post
Remy Lebeau 1436 Posted August 29 (edited) Why are you re-compiling Winapi.Windows.pas? You should not be doing that. In any case, Winapi.Windows.pas declares the _CONTEXT record only if the CPUX64 or CPUX86 conditional is defined. Perhaps they are not defined in your situation? Edited August 29 by Remy Lebeau 1 Share this post Link to post
Kas Ob. 124 Posted August 29 Cross your fingers and restart the IDE and. Share this post Link to post
William23668 8 Posted August 29 4 minutes ago, Remy Lebeau said: Why are you re-compiling Winapi.Windows.pas? You should not be doing that. In any case, Winapi.Windows.pas declares the _CONTEXT record only if the CPUX64 or CPUX86 conditional is defined. Perhaps they are not defined in your situation? It is old Android app when I compile it give me the above error. I tried compile Android 32bit and 64bit. Is there something else to do ? Share this post Link to post
William23668 8 Posted August 29 4 minutes ago, Kas Ob. said: Cross your fingers and restart the IDE and. Tried that same problem. Share this post Link to post
Remy Lebeau 1436 Posted August 29 (edited) 6 minutes ago, William23668 said: It is old Android app when I compile it give me the above error. I tried compile Android 32bit and 64bit. Is there something else to do ? The Winapi.Windows unit is for Windows builds only. If the component is trying to use that unit in an Android build, then its code is not IFDEF'ed properly to separate any platform-specific code, and thus needs to be fixed accordingly. Edited August 29 by Remy Lebeau 2 Share this post Link to post
William23668 8 Posted August 29 3 minutes ago, Remy Lebeau said: The Winapi.Windows unit is for Windows only, you can't use it on Android. Which means if the component is trying to use that unit on an Android build then its code is not IFDEF'ed properly. Yes _CONTEXT define like this inside IFDEF _CONTEXT = record . But I can not modify this source file to make _CONTEXT inside IFDEF Share this post Link to post
DelphiUdIT 187 Posted August 29 13 minutes ago, William23668 said: Yes _CONTEXT define like this inside IFDEF _CONTEXT = record . But I can not modify this source file to make _CONTEXT inside IFDEF Remy wanted to point out that the WINDOWS or WINAPI unit must not be present in an Android program and that IFDEF is normally used to distinguish Android from Windows (if the program must be multiplatform). Look in the USES of your program and REMOVE all the references to WINDOWS or WINAPI (or use IFDEF in your source to divide the platforms of use and include or not those units.). 2 Share this post Link to post
William23668 8 Posted August 29 2 minutes ago, DelphiUdIT said: Look in the USES of your program and REMOVE all the references to WINDOWS or WINAPI Ok. Will check all files. Share this post Link to post
Remy Lebeau 1436 Posted August 29 3 hours ago, DelphiUdIT said: Remy wanted to point out that the WINDOWS or WINAPI unit must not be present in an Android program and that IFDEF is normally used to distinguish Android from Windows (if the program must be multiplatform). Yes, exactly, for example: uses ... {$IFDEF MSWINDOWS}, Winapi.Windows{$ENDIF} {$IFDEF ANDROID}, Androidapi.SomeOtherUnit{$ENDIF} ... ; 2 Share this post Link to post