Author Topic: Compiling Codeblocks  (Read 15509 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Compiling Codeblocks
« Reply #15 on: February 20, 2005, 04:04:35 am »
Hmmm... since i'm kinda having experience in this field, i think i'm qualified to say this:

"Undefined reference to (wxwidgets class)" usually mean that the make is not linking the wxWidgets library.

And now, the questions (i think i'm gonna include them in the FAQ i'm making):

Did you compile wxWidgets using WXMAKINGDLL and then WXUSINGDLL?

Did you copy ALL the subdirectories under (WXDIR)/include and (WXDIR)/lib to your MINGW installation (including of course the contrib  ones)?

Did you copy the (WXDIR)/lib/mswdll/wx/setup.h to /include/wx ?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
AGH!!
« Reply #16 on: February 20, 2005, 06:12:47 am »
I just realized I'm having exactly the same problems compiling a hello world! :shock:

UPDATE: Yiannis solved it above. You just have to reset the compiler options.

Offline rz950

  • Multiple posting newcomer
  • *
  • Posts: 13
Compiling Codeblocks
« Reply #17 on: February 20, 2005, 05:15:54 pm »
Yes, rickg22 i forgot to compile the contrib libs and that was part of the problem. Plus the same problem you had with hello world helped me.

Offline rz950

  • Multiple posting newcomer
  • *
  • Posts: 13
Compiling Codeblocks
« Reply #18 on: February 21, 2005, 06:45:08 pm »
Well, Wxwindows 2.5.3 compiled fine but Code::Blocks still doesn't compile and I did excatly what you said(rickg22)

(Maybe it's just that i'm to lazy to try to fix the problems ;) )

Edited: I forgot to paste the error so here it is

Code: [Select]

Compiling: sdk\cbproject.cpp
In file included from C://MinGW//include/wx/wx/wxchar.h:143,
                 from C://MinGW//include/wx/debug.h:22,
                 from C://MinGW//include/wx/wx/defs.h:456,
                 from C://MinGW//include/wx/dynarray.h:20,
                 from sdk\\/cbproject.h:4,
                 from sdk\\cbproject.cpp:27:
C://MinGW//include/tchar.h:274:1: warning: "_puttchar" redefined
In file included from C://MinGW//include/wx/platform.h:469,
                 from C://MinGW//include/wx/wx/defs.h:25,
                 from C://MinGW//include/wx/dynarray.h:20,
                 from sdk\\/cbproject.h:4,
                 from sdk\\cbproject.cpp:27:
C://MinGW//include/wx/wx/msw/gccpriv.h:108:1: warning: this is the location of the previous definition
sdk\\cbproject.cpp: In member function `void cbProject::Open()':
sdk\\cbproject.cpp:251: error: `wxSingleChoiceDialog' undeclared (first use this function)
sdk\\cbproject.cpp:251: error: (Each undeclared identifier is reported only once for each function it appears in.)
sdk\\cbproject.cpp:251: error: expected `;' before "dlg"
sdk\\cbproject.cpp:256: error: `dlg' undeclared (first use this function)
sdk\\cbproject.cpp: In member function `void cbProject::AddTreeNode(wxTreeCtrl*, const wxString&, const wxTreeItemId&, bool, bool, FileTreeData*)':
sdk\\cbproject.cpp:588: warning: `GetFirstChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:405)
sdk\\cbproject.cpp:594: warning: `GetNextChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:407)
sdk\\cbproject.cpp:602: warning: `GetFirstChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:405)
sdk\\cbproject.cpp:620: warning: `GetNextChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:407)
Process terminated with status 1 (0 minutes, 30 seconds)
4 errors, 6 warnings
 

Offline prr

  • Single posting newcomer
  • *
  • Posts: 6
Compiling Codeblocks
« Reply #19 on: February 22, 2005, 12:07:43 am »
Quote from: rz950
Well, Wxwindows 2.5.3 compiled fine but Code::Blocks still doesn't compile and I did excatly what you said(rickg22)

(Maybe it's just that i'm to lazy to try to fix the problems ;) )

Edited: I forgot to paste the error so here it is

Code: [Select]

Compiling: sdk\cbproject.cpp
In file included from C://MinGW//include/wx/wx/wxchar.h:143,
                 from C://MinGW//include/wx/debug.h:22,
                 from C://MinGW//include/wx/wx/defs.h:456,
                 from C://MinGW//include/wx/dynarray.h:20,
                 from sdk\\/cbproject.h:4,
                 from sdk\\cbproject.cpp:27:
C://MinGW//include/tchar.h:274:1: warning: "_puttchar" redefined
In file included from C://MinGW//include/wx/platform.h:469,
                 from C://MinGW//include/wx/wx/defs.h:25,
                 from C://MinGW//include/wx/dynarray.h:20,
                 from sdk\\/cbproject.h:4,
                 from sdk\\cbproject.cpp:27:
C://MinGW//include/wx/wx/msw/gccpriv.h:108:1: warning: this is the location of the previous definition
sdk\\cbproject.cpp: In member function `void cbProject::Open()':
sdk\\cbproject.cpp:251: error: `wxSingleChoiceDialog' undeclared (first use this function)
sdk\\cbproject.cpp:251: error: (Each undeclared identifier is reported only once for each function it appears in.)
sdk\\cbproject.cpp:251: error: expected `;' before "dlg"
sdk\\cbproject.cpp:256: error: `dlg' undeclared (first use this function)
sdk\\cbproject.cpp: In member function `void cbProject::AddTreeNode(wxTreeCtrl*, const wxString&, const wxTreeItemId&, bool, bool, FileTreeData*)':
sdk\\cbproject.cpp:588: warning: `GetFirstChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:405)
sdk\\cbproject.cpp:594: warning: `GetNextChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:407)
sdk\\cbproject.cpp:602: warning: `GetFirstChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:405)
sdk\\cbproject.cpp:620: warning: `GetNextChild' is deprecated (declared at C://MinGW//include/wx/wx/msw/treectrl.h:407)
Process terminated with status 1 (0 minutes, 30 seconds)
4 errors, 6 warnings
 


The Error
well, probably something has changed in wxw 2.5 headers organization.

Add this directive to the file "sdk\cbproject.cpp"
#include <wx/generic/choicdgg.h>

The Warning
the warning instead is generated by a double definition of _puttchar, recently added in new MingW versions (>=3.3). The problem is that althought the wxw header (msw\gccpriv.h) seems to correctly check for mingw version:
Code: [Select]

...

#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION)
    #define wxCHECK_MINGW32_VERSION( major, minor ) \
 ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
      || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
#else
    #define wxCHECK_MINGW32_VERSION( major, minor ) (0)
#endif

...
...

#if defined( __MINGW32__ ) && \
        !wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar )
    #ifdef wxUSE_UNICODE
        #define  _puttchar   putwchar
    #else
        #define  _puttchar   puttchar
    #endif
#endif

...


the check does not work, infact wxCHECK_MINGW32_VERSION is defined as "(0)".

Both  __MINGW32_MAJOR_VERSION and __MINGW32_MINOR_VERSION are not internally defined by the compiler (you can verify it with this command: "gcc -E -dM -x c gccintdef.txt") but defined in the "_mingw.h" file. So problably __MINGW32_MAJOR_VERSION and __MINGW32_MINOR_VERSION are defined after "msw\gccpriv.h".

Tomorrow I'll check better.

walter

Anonymous

  • Guest
Compiling Codeblocks
« Reply #20 on: February 22, 2005, 01:20:55 pm »
Oh, Thanks and yes the mingw check doesn't work but the fix did :)