User forums > Help

Compiling Codeblocks

<< < (4/5) > >>

rickg22:
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 ?

rickg22:
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.

rz950:
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.

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: ---
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
 
--- End code ---

prr:

--- 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: ---
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
 
--- End code ---

--- End quote ---


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: ---
...

#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

...

--- End code ---


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

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version