PlanetSquires Forums

Support Forums => José Roca Software => Topic started by: docroger on July 31, 2025, 06:33:48 AM

Title: Error with C backend
Post by: docroger on July 31, 2025, 06:33:48 AM
Hello José, me again...

With the last version afxnova (with tabs) : i cant compile with gcc :

Quoteerror: '_ZTSN14AFX_IDISPATCH_E' undeclared here (not in a function); did you mean '_ZN14AFX_IDISPATCH_C1Ev'?
 3274 | static struct $8fb_RTTI$ _ZTSN7AFXNOVA16AFX_IDICTIONARY_E = { (void*)0ull, (char*)"N7AFXNOVA16AFX_IDICTIONARY_E", &_ZTSN14AFX_IDISPATCH_E };
      |                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                    _ZN14AFX_IDISPATCH_C1Ev


With GAS64 : no error.
My app is broken.

PS : if i comment include afxnova/cinifile.inc : the code compile fine with GCC...
Title: Re: Error with C backend
Post by: José Roca on July 31, 2025, 09:57:53 AM
Works in my computer. I don't know what this cryptic message means.
Title: Re: Error with C backend
Post by: José Roca on July 31, 2025, 10:00:52 AM
> With the last version afxnova (with tabs) : i cant compile with gcc :

You can't compile what?
Title: Re: Error with C backend
Post by: docroger on July 31, 2025, 11:37:00 AM
My app use AFXnova DDT + Cinifile : compile well with prec version AFXnova.

With the latest : compile with GAS64 but error with GCC.

If i comment then include cinifile on my app : compile with GCC.

Without Cinifile no problem.
The error message is linker message.
Title: Re: Error with C backend
Post by: docroger on July 31, 2025, 02:33:41 PM
With the latest afxnova on github :

This code dont compile with cbackend (x64) with error :

error: '_ZTSN14AFX_IDISPATCH_E' undeclared here (not in a function); did you mean '_ZN14AFX_IDISPATCH_C1Ev'?
3103 | static struct $8fb_RTTI$ _ZTSN7AFXNOVA16AFX_IDICTIONARY_E = { (void*)0ull, (char*)"N7AFXNOVA16AFX_IDICTIONARY_E", &_ZTSN14AFX_IDISPATCH_E };
      |                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                    _ZN14AFX_IDISPATCH_C1Ev
compiling C failed: 'E:\perso\dev\freebasic\tiko-1.2.3\Toolchains\FreeBASIC-1.10.1-winlibs-gcc-9.3.0\bin\win64\gcc.exe' terminated with exit code 1


'#TEMPLATE DDT Dialog with a button
#define UNICODE
#define _WIN32_WINNT &h0602
#include once "AfxNova/DDT.inc"

'comment this line >>> compile fine
#include once "afxnova/cinifile.inc"


USING AfxNova

DECLARE FUNCTION wWinMain (BYVAL hInstance AS HINSTANCE, _
                           BYVAL hPrevInstance AS HINSTANCE, _
                           BYVAL pwszCmdLine AS WSTRING PTR, _
                           BYVAL nCmdShow AS LONG) AS LONG
   END wWinMain(GetModuleHandleW(NULL), NULL, wCommand(), SW_NORMAL)

DECLARE FUNCTION DlgProc (BYVAL hDlg AS HWND, BYVAL uMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LPARAM) AS INT_PTR

CONST IDC_OK = 1001

' ========================================================================================
' Main
' ========================================================================================
FUNCTION wWinMain (BYVAL hInstance AS HINSTANCE, _
                   BYVAL hPrevInstance AS HINSTANCE, _
                   BYVAL pwszCmdLine AS WSTRING PTR, _
                   BYVAL nCmdShow AS LONG) AS LONG

   ' // Set process DPI aware
   SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
   ' // Enable visual styles without including a manifest file
   AfxEnableVisualStyles

   ' // Create a new dialog using dialog units
   DIM hDlg AS HWND = DialogNew(0, "DDT Dialog with a button", 50, 50, 175, 65, WS_OVERLAPPEDWINDOW OR DS_CENTER)

   ' // Add a button to the dialog
   ControlAddButton, hDlg, IDC_OK, "&Ok", 105, 40, 50, 12, BS_DEFPUSHBUTTON

   ' // Anchor the button to the bottom and the right side of the dialog
   ControlAnchor(hDlg, IDC_OK, AFX_ANCHOR_BOTTOM_RIGHT)

   ' // Display and activate the dialog as modal
   DialogShowModal(hDlg, @DlgProc)

   RETURN DialogEndResult(hDlg)

END FUNCTION
' ========================================================================================

' ========================================================================================
' Dialog callback procedure
' ========================================================================================
FUNCTION DlgProc (BYVAL hDlg AS HWND, BYVAL uMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LPARAM) AS INT_PTR
  
   SELECT CASE uMsg

      CASE WM_INITDIALOG
         RETURN TRUE

      CASE WM_COMMAND
         SELECT CASE CBCTL(wParam, lParam)
            CASE IDCANCEL
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF CBCTLMSG(wParam, lParam) = BN_CLICKED THEN
                  SendMessageW hDlg, WM_CLOSE, 0, 0
               END IF
            CASE IDC_OK
               MsgBox("OK button pressed", MB_ICONEXCLAMATION OR MB_TASKMODAL, "Message")
         END SELECT

      CASE WM_CLOSE
         ' // End the application
         DialogEnd(hDlg)

   END SELECT

   RETURN FALSE

END FUNCTION

Title: Re: Error with C backend
Post by: Paul Squires on July 31, 2025, 03:22:27 PM
That's strange. I am also getting that same error when trying to compile with gcc. Hopefully it is not a Tiko Editor problem with the compiling of the source code. I will have to try compiling it with a different editor (or command line) just to be sure.
Title: Re: Error with C backend
Post by: José Roca on July 31, 2025, 04:26:38 PM
Found the problem. Remove NAMESPACE AfxNova and END NAMESPACE in AfxScrRun.bi
Title: Re: Error with C backend
Post by: José Roca on July 31, 2025, 05:42:32 PM
Never had tried gcc before. Optimizing for size reduces the size of the executable very much.
Title: Re: Error with C backend
Post by: Paul Squires on July 31, 2025, 08:42:53 PM
Ah, that's good news that you found the cause of the problem!