Saturday, December 27, 2014

C++ Builder glut.h error: One set of overloaded "c" functions


1) Add the following lines :

#include <stdlib.h> //bring exit into global scope
#endif //ERIC CHANGE

Just above the lines:
#endif /* _WIN32 */

#include <GL/gl.h>
#include <GL/glu.h>
Around line 133 in glut.h(atleast in the one I have)

2) Then change line 146 in glut.h or the line that declares the extern _CRTIMP void __cdecl exit(int);
with the following:

//in borland this function is not extern C.
//stdlib.h is included somewhere above 
extern _CRTIMP void __cdecl exit(int);

libTiff 讀取 Photoshop 建立含有 image pyramid 的 tiff 檔 出現 Access violation at ....'CC32120MT.DLL'....

在 VCL form application 會出現問題.
在 Console 程式沒有問題.

原因, 以乎與 VCL 有關, 待查

Friday, November 14, 2014

[C++ Builder] GCRC command line fail

Occur when compile language resources file.

[Solution] move include file paths from [project] [options] to C++ Builder [Tools][Options]

Sunday, October 19, 2014

[DCC Fatal Error] reinit.pas(1): F1027 Unit not found: 'System.pas' or binary equivalents (.dcu)

移除 C++ Builder (XE3) 之後, 重新安裝, 而且把安裝位置從 C: 變更為 D:。
Build 舊專案出現這個訊息:

[DCC Fatal Error] reinit.pas(1): F1027 Unit not found: 'System.pas' or binary equivalents (.dcu)

google 得到的答案是 lib 路徑的問題.
後來發現,既然是 Delphi 的問題, 應該要設定的是 Delphi 的路徑。

搜尋硬碟找到 system.dcu 在資料夾 d:\Program Files (x86)\Embarcadero\RAD Studio\10.0\lib\win32\release

所以,在 [Tools] [Options...] [Environment Options] [Delphi Options] [Library] [Library path:]

d:\Program Files (x86)\Embarcadero\RAD Studio\10.0\lib\win32\release


Monday, March 31, 2014

[C++ Builder] Show a form before Mainform is shown


Sometimes, an application requires to show a form before the Mainform. This following code shows how to create and show a form (DialogSelectLanguage) before Mainform (FornMain) is show.

Notice: DialogSelectLanguage should be moved to < Avaliable forms > ( [Project] [Options...] [Form] )


// Create a form before Mainform is creacted.
  DialogSelectLanguage = new TDialogSelectLanguage(Application);   // Show the form
  DialogSelectLanguage->Release(); // If needed

  // Create Mainform  Application->CreateForm(__classid(TFormMain), &FormMain); 
  return 0;  

Friday, March 28, 2014

[C++ Builder] [ EReadError with message 'Ancestor for '' not found' ] raised when the user changes language at a multi-language application


This error is raised when the user changes language at a multi-language application. It is because there is one or more components whose Name property is empty (""). To solve this problem, the empty-Name component should be found and set a name. Please see the method to find the component whose name is empty from the application. Because the component has no name, you can identify it by its class name and which form it is only.
For example, a TLable component with no Name is found. Go to the object inspector of the form, you will see the component <Components[43]> is located at the top of object inspector and its Name property is empty, as shown in the picture. (At this example, the TLabel component is inside Panel1 )

Then you can set a name to the component and the problem solved.

[C++ Builder] How to search components in the application

The following code search the component whose Name is empty("").

TComponent *pform, *pcomponent;
AnsiString NoNameComponent;

for( int ff=0; ff< Application->ComponentCount; ff++) {   
  pform = Application->Components[ff];  // get a form
    for( int i=0; i< pform->ComponentCount; i++ ) {        
    pcomponent = pform->Components[i];  // get a component
    if( pcomponent->Name == "" )  {
      NoNameComponent = pcomponent->ClassName()
                      +" at "+pform->Name + "has no name";

Sunday, March 2, 2014

Cannot detect Sony Xperia Tablet Z in Eclipse


[Solution]  Set [USB connection mode] to [Mass storage mode (MSC)]
Xperia has very strange option:
Settings > Xperia > USB Connectivity > USB connection mode
and select Mass storage mode (MSC)

[Qt] 執行檔需要哪些 Dll?

 1. 使用 Qt  的 windeployqt.exe 工具 (在 C:\Qt\Qt5.14.1\5.14.1\msvc2017\bin\)。   a. 把執行檔 myProgram.exe 放在某個資料夾。   b. 在檔案總管這個資料夾按 Shift 和滑鼠右鍵,開啟 Po...