In this code:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdIOHandler, IdGlobal, StdCtrls;
function WaitForCommand(args: Pointer): Cardinal; stdcall;
begin
while client.Connected do
if not HandleResponse(client.IOHandler) then
break;
Result := 0;
end;
I have this error:
[DCC Error] Unit1.pas(159): E2003 Undeclared identifier: ‘HandleResponse’
артист 98 / 33 / 21 Регистрация: 17.09.2014 Сообщений: 1,497 |
||||||||
1 |
||||||||
12.10.2017, 01:58. Показов 3120. Ответов 5 Метки нет (Все метки)
Ругалось на null в этой строке:
Погуглил, гугл сказал, что это из библиотеки Variants, переменная без значения. Поставил просто 0 — всё скомпилировалось:
Но т.к. я пока не разобрался с основами, решил уточнить. А где вообще взять эту библиотеку(Variants)?
0 |
пофигист широкого профиля 4661 / 3095 / 855 Регистрация: 15.07.2013 Сообщений: 17,846 |
|
12.10.2017, 02:05 |
2 |
В Дельфи есть модуль Variants. На него в первую очередь и смотрите.
Ругалось на null в этой строке: Более подробно код приведите.
1 |
артист 98 / 33 / 21 Регистрация: 17.09.2014 Сообщений: 1,497 |
||||||||||||||||||||
12.10.2017, 16:02 [ТС] |
3 |
|||||||||||||||||||
4я строка:
В uses он есть:
А в компиляторе нет, видимо, я не знаю где его искать… Добавлено через 13 часов 33 минуты
Добавлено через 16 минут
Вообще не работает.
0 |
12 / 10 / 5 Регистрация: 22.07.2015 Сообщений: 201 |
|
12.10.2017, 16:53 |
4 |
Какая версия программы. Variants это старое название модуля не помню до какой версии. System.Variants новое. Попробуй либо (Variants либо System.Variants). {$IFDEF DELPHI_6_UP}{$ENDIF} эта конструкция указывает компилятору на какой версии использовать Variants. Если версия не подходит он игнорирует модуль.
1 |
артист 98 / 33 / 21 Регистрация: 17.09.2014 Сообщений: 1,497 |
||||
12.10.2017, 19:01 [ТС] |
5 |
|||
У меня с Variants работает.
{$IFDEF DELPHI_6_UP}{$ENDIF} эта конструкция указывает компилятору на какой версии использовать Variants. Не указывало, там инклуд был с макросами, не знаю, может я чего не так сделал, но он валялся в папке с исходниками, а в исходниках вверху было такое:
В общем поудалял я нафиг всё, получилось работать будет с 7й и выше версии, у меня 10ка, норм.
0 |
12 / 10 / 5 Регистрация: 22.07.2015 Сообщений: 201 |
|
13.10.2017, 11:59 |
6 |
Сообщение было отмечено артист как решение Решение
{$I mxs.inc} Эта строка подключает дополнительный файл где и описано
{$IFDEF DELPHI_6_UP} операторы {$ENDIF} что входит в этот промежуток. Если условие выполняется, то операторы выполняются. Если не выполняется, то операторы игнорируются.
1 |
Go Up to Error and Warning Messages (Delphi)
The compiler could not find the given identifier — most likely it has been misspelled either at the point of declaration or the point of use. It might be from another unit that has not mentioned a uses clause.
program Produce; var Counter: Integer; begin Count := 0; Inc(Count); Writeln(Count); end.
In the example, the variable has been declared as «Counter», but used as «Count». The solution is to either change the declaration or the places where the variable is used.
program Solve; var Count: Integer; begin Count := 0; Inc(Count); Writeln(Count); end.
In the example we have chosen to change the declaration — that was less work.
Delphi Compiler Error
E2003 Undeclared identifier ‘%s’
Reason for the Error & Solution
The compiler could not find the given identifier – most likely it has been misspelled either at the point of declaration or the point of use. It might be from another unit that has not mentioned a uses clause.
program Produce; var Counter: Integer; begin Count := 0; Inc(Count); Writeln(Count); end.
In the example, the variable has been declared as “Counter”, but used as “Count”. The solution is to either change the declaration or the places where the variable is used.
program Solve; var Count: Integer; begin Count := 0; Inc(Count); Writeln(Count); end.
In the example we have chosen to change the declaration – that was less work.
E2003 Undeclared identifier ‘ShortDateFormat’ error in Delphi XE3 or later versions
E2003 Undeclared identifier ‘ShortDateFormat’ error in Delphi XE3 or later versions
When we upgrade a Delphi old version application to Delphi XE3 or latest one then if we have used ‘ShortDateFormat‘ global variable in our project then we will get ‘E2003 Undeclared identifier ‘ShortDateFormat’ compiler error.
Why we get this error?
As some global variables typically pertain to Date, Time and Currency format (CurrencyString, ShorDateFormat, LongTimeFormat, ShortMonthNames, and so on) have been deprecated and removed declaration from Delphi XE3 or later versions. In old Delphi versions we can find this variables declaration in ‘System.SysUtils’ unit but from Delphi XE3 those are moved with TFormatSettings Record.
Workarounds to solve this error.
We can replace ‘ShortDateFormat‘ with ‘Formatsettings.ShortDateFormat’. And ‘FormatSettings‘ is a global variable of ‘TFormatSettings’ type declared in ‘SysUtils‘ which having these variables.
Errors when we migrate a project from Delphi 7 to Delphi XE3
Undeclared identifier DecimalSeparator
Undeclared identifier CurrencyFormat
Undeclared identifier ThousandSeparator
Undeclared identifier DateSeparator
Undeclared identifier TimeSeparator
Undeclared identifier ShortDateFormat
Undeclared identifier LongDateFormat
Solution to above errors
Formatsettings.DecimalSeparator
Formatsettings.CurrencyFormat
Formatsettings.ThousandSeparator
Formatsettings.DateSeparator
Formatsettings.TimeSeparator
Formatsettings.ShortDateFormat
Formatsettings.LongDateFormat
Following are some other global variables also having same issue:
Global Variable (System.SysUtils) |
Corresponding TFormatSettings Field |
---|---|
CurrencyDecimals |
CurrencyDecimals |
CurrencyFormat |
CurrencyFormat |
CurrencyString |
CurrencyString |
DateSeparator |
DateSeparator |
DecimalSeparator |
DecimalSeparator |
ListSeparator |
ListSeparator |
LongDateFormat |
LongDateFormat |
LongDayNames |
LongDayNames |
LongDayNames |
LongDayNames |
LongTimeFormat |
LongTimeFormat |
NegCurrFormat |
NegCurrFormat |
ShortDateFormat |
ShortDateFormat |
ShortDayNames |
ShortDayNames |
ShortMonthNames |
ShortMonthNames |
ShortTimeFormat |
ShortTimeFormat |
ThousandSeparator |
ThousandSeparator |
TimeAMString |
TimeAMString |
TimePMString |
TimePMString |
TimeSeparator |
TimeSeparator |
TwoDigitYearCenturyWindow |
TwoDigitYearCenturyWindow |
Popular posts from this blog
ShellExecute in Delphi
ShellExecute in Delphi – Launch external applications. ShellExecute is Delphi Windows API function that is mostly used for launch external applications from our Delphi application. This function is linked to the ShellExecute Windows API function. The function returns an integer that corresponds to an error code which is very useful when we need to show some status if the function worked or not . By using ShellExecute we can also do following operations…. Can print documents from within my program, without explicitly starting the application that created the document, such as: print a Word-document without starting Word. Can open browser with a local HTML page Can surf to a site i.e. open an external URL link from a Delphi application Can send mails thorugh outlook Syntax of Windows API function HINSTANCE ShellExecute( _In_opt_ HWND hwnd, _In_opt_ LPCTSTR lpOperation, _In_ LPCTSTR lpFile, _In_opt_ LPC
Drawing Shapes in Delphi
Believe me, drawing shapes in Delphi is so easy. To develop a software like CAD, Paint, CorelDraw Delphi provides large number of classes and members that supports to draw shapes on a form or on a graphic control. In Delphi, we draw shapes on canvas of a form or graphic controls. Canvas is an area of form where we can draw shapes, lines and can fill colors on shapes. In Delphi, every form or graphic controls have Canvas property which provides TCanvas object that can be used to draw shapes. TPen object is used to draw lines and we can set size, color of lines. TBrush object is used to set color and style to fill the shapes. Most frequently used classes for drawing shapes are TCanvas , TBitmap, TGraphics, TPen, TBrush TCanvas Use TCanvas as a drawing surface for objects that draw an image of themselves TBitmap Bitmap is a powerful graphics object used to create, manipulate (scale, scroll, rotate, and paint), and store images in memory and as files on a disk. TGraphics TGr
MS Excel Automation in Delphi
In this blog I will describe how to read and write data from and to an Excel file. Sometime in our application we use Excel for reporting purpose, for data import / export purpose and for other works. So here I will explain how to access an Excel file and use for data read / write. For this Excel 2003 or later should have installed in our system. First use Excel2000 unit to uses clause. This unit comes with Delphi installation it self. You can get the unit in installed path C:Program Files (x86)EmbarcaderoRAD Studio10.0OCXServers Uses Excel2000; Before proceed I would mention an important word LCID which is required at most places. So what it LCID? LCID = In Microsoft Excel, the LCID indicates the currency symbol to be used when this is an xlListDataTypeCurrency type. Returns 0 (which is the Language Neutral LCID) when no locale is set for the data type of the column. We can get LCID in Delphi by using GetUserDefaultLCID function.. privat