Author Topic: Error compiling ScintillaWX.cpp  (Read 3342 times)

Offline olipfei

  • Multiple posting newcomer
  • *
  • Posts: 26
Error compiling ScintillaWX.cpp
« on: June 20, 2008, 10:37:53 pm »
Hello,

I have a problem compiling the wxScintilla component of CB's latest revision 5102 on Linux. I get the following message:
Code
src/ScintillaWX.cpp: In member function `virtual void ScintillaWX::Paste()':
src/ScintillaWX.cpp:505: error: variable declaration is not allowed here
src/ScintillaWX.cpp:506: error: no matching function for call to `wxClipboard::
   GetData(wxCustomDataObject (&)())'
/usr/include/wx-2.8/wx/gtk/clipbrd.h:42: error: candidates are: virtual bool
   wxClipboard::GetData(wxDataObject&)
src/ScintillaWX.cpp:508: error: request for member `GetSize' in `selData',
   which is of non-aggregate type `wxCustomDataObject ()()'
src/ScintillaWX.cpp:509: error: request for member `GetData' in `selData',
   which is of non-aggregate type `wxCustomDataObject ()()'
src/ScintillaWX.cpp:511: error: request for member `GetDataSize' in `selData',
   which is of non-aggregate type `wxCustomDataObject ()()'

From the svn log I see that ScintillaWx.cpp was modified at revision 5089 affecting lines 505 (where the error occurs) and 558 (where no error occurs). If I revert line 505 (but not 558) to its previous version (that is, setting selData's contructor argument to wxDF_PRIVATE again), it compiles fine. Furthermore, if I replace lines 505-511 by the following code fragment:
Code
        wxCustomDataObject *selData = new wxCustomDataObject (wxDataFormat(wxString(wxT("application/x-cbrectdata"))));
        bool gotRectData = wxTheClipboard->GetData(*selData);

        if (gotRectData && selData->GetSize()>1) {
            const char* rectBuf = (const char*)selData->GetData();
            rectangular = rectBuf[0] == (char)1;
            len = selData->GetDataSize()-1;

(that is, imitating lines 558ff. by defining selData to be a pointer rather than an object; selData is deleted a few lines below), it compiles fine, too.

My system:
  • SuSE Linux 9.1,
  • wxGTK 2.8.7 ANSI,
  • gcc 3.3.3.

I am aware of the fact that this equipment is fairly old, but sometimes it reveals lower-lying problems that would not appear otherwise. Since I presume that for those building CB on newer systems everthing works fine, I would really like to hear your opinions.

Perhaps I should also stress that I don't have this problem on Windows 2000, using wxMSW 2.8.7 ANSI and gcc 3.4.5 shipped with CB! Weird...

Regards,
Oliver

Offline olipfei

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Error compiling ScintillaWX.cpp
« Reply #1 on: July 03, 2008, 01:00:51 pm »
Hello guys,

I know, it's holiday time, but is no one else experiencing my phenomenon (as sometimes in the past)? Otherwise I will submit my workaround as patch, as it seems consistent with the rest of the code to me.

Regards,
Oliver

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Error compiling ScintillaWX.cpp
« Reply #2 on: July 03, 2008, 03:08:35 pm »
The code used in the svn-repository seems to be OK. The problem in your case is not the code but your horribly outdated compiler. I'm not sure if this compiler should still be supported (I would not do it). If yes your patch should be applied. But I strongly suggest that you upgrade your compiler.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.