Author Topic: problem at compiling a project with wxWidgets  (Read 9843 times)

mkd

  • Guest
problem at compiling a project with wxWidgets
« on: March 24, 2009, 08:22:39 pm »
Hi all,

I've got a quite strange problem. I installed wxWidgets (wxPack) a few days ago and everything worked well - till yesterday. Since yesterday (I didn't change anything in the project / compiler options) I'm getting tons of errors when I'm trying to compile a project with wxWidgets. Alle other project files compile without problems. The most interesting thing is: the problem first appeared short after a successful compilation (I didn't restart Codeblocks).

Quote
cc1.exe: warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: not for GNU C
In file included from C:/Frameworks/wxWidgets2.8.9/include/wx/wxprec.h:46,
                 from ./wx_pch.h:14,
                 from <command line>:7:
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h: In function `wxSetCCUnicodeFormat':
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:48: error: syntax error before ':' token
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h: At top level:
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:58: error: syntax error before "wxFont"
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:58: warning: type defaults to `int' in declaration of `wxFont'
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:58: warning: data definition has no type or storage class
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:59: error: syntax error before "wxGetCCDefaultFont"
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:59: warning: type defaults to `int' in declaration of `wxGetCCDefaultFont'
C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcctl.h:59: warning: data definition has no type or storage class
In file included from C:/Frameworks/wxWidgets2.8.9/include/wx/string.h:55,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/log.h:47,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/private.h:24,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcdlg.h:18,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/wxprec.h:47,
                 from ./wx_pch.h:14,
                 from <command line>:7:
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:127: warning: type defaults to `int' in declaration of `class'
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:127: error: syntax error before "wxCharBuffer"
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:127: error: syntax error before ':' token
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h: In function `release':
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:127: error: syntax error before '{' token
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:152: warning: type defaults to `int' in declaration of `wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:152: error: storage class specified for parameter `wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:152: error: syntax error before "wxWxCharBuffer"
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:218: error: syntax error before "private"
In file included from C:/Frameworks/wxWidgets2.8.9/include/wx/string.h:56,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/log.h:47,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/private.h:24,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcdlg.h:18,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/wxprec.h:47,
                 from ./wx_pch.h:14,
                 from <command line>:7:
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:88: warning: type defaults to `int' in declaration of `wxWCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:88: error: syntax error before "cMB2WC"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:89: warning: type defaults to `int' in declaration of `wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:89: error: conflicting types for 'wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/buffer.h:152: error: previous definition of 'wxCharBuffer' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:89: error: syntax error before "cWC2MB"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:104: warning: type defaults to `int' in declaration of `wxWCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:104: error: redefinition of parameter 'wxWCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:88: error: previous definition of 'wxWCharBuffer' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:104: error: syntax error before "cMB2WC"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:106: warning: type defaults to `int' in declaration of `wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:106: error: redefinition of parameter 'wxCharBuffer'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:89: error: previous definition of 'wxCharBuffer' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:106: error: syntax error before "cWC2MB"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:115: error: syntax error before "const"
In file included from C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:361,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/string.h:56,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/log.h:47,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/private.h:24,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcdlg.h:18,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/wxprec.h:47,
                 from ./wx_pch.h:14,
                 from <command line>:7:
C:/Frameworks/wxWidgets2.8.9/include/wx/fontenc.h:148: warning: enum defined inside parms
C:/Frameworks/wxWidgets2.8.9/include/wx/fontenc.h:148: warning: empty declaration
In file included from C:/Frameworks/wxWidgets2.8.9/include/wx/string.h:56,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/log.h:47,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/private.h:24,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/msw/wrapcdlg.h:18,
                 from C:/Frameworks/wxWidgets2.8.9/include/wx/wxprec.h:47,
                 from ./wx_pch.h:14,
                 from <command line>:7:
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:363: error: syntax error before "class"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:398: error: syntax error before "const"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:411: error: syntax error before "wxFontEncoding"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:425: warning: type defaults to `int' in declaration of `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:425: error: storage class specified for parameter `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:425: error: syntax error before '&' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:428: warning: type defaults to `int' in declaration of `wxCSConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:428: error: storage class specified for parameter `wxCSConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:428: error: syntax error before '&' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:429: warning: type defaults to `int' in declaration of `wxMBConvUTF7'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:429: error: storage class specified for parameter `wxMBConvUTF7'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:429: error: syntax error before '&' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:430: warning: type defaults to `int' in declaration of `wxMBConvUTF8'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:430: error: storage class specified for parameter `wxMBConvUTF8'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:430: error: syntax error before '&' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:439: warning: type defaults to `int' in declaration of `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:439: error: storage class specified for parameter `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:439: error: redefinition of parameter 'wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:425: error: previous definition of 'wxMBConv' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:439: error: syntax error before '*' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:446: warning: type defaults to `int' in declaration of `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:446: error: storage class specified for parameter `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:446: error: redefinition of parameter 'wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:439: error: previous definition of 'wxMBConv' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:446: error: syntax error before '*' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:449: warning: type defaults to `int' in declaration of `wxCSConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:449: error: storage class specified for parameter `wxCSConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:449: error: redefinition of parameter 'wxCSConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:428: error: previous definition of 'wxCSConv' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:449: error: syntax error before '&' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:455: warning: type defaults to `int' in declaration of `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:455: error: storage class specified for parameter `wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:455: error: redefinition of parameter 'wxMBConv'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:446: error: previous definition of 'wxMBConv' was here
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:455: error: syntax error before '*' token
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:465: warning: type defaults to `int' in declaration of `wxMBConvUTF16LE'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:465: error: storage class specified for parameter `wxMBConvUTF16LE'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:465: error: syntax error before "wxMBConvUTF16"
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:466: warning: type defaults to `int' in declaration of `wxMBConvUTF32LE'
C:/Frameworks/wxWidgets2.8.9/include/wx/strconv.h:466: error: storage class specified for parameter `wxMBConvUTF32LE'

Thanks in advance,

mkd

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: problem at compiling a project with wxWidgets
« Reply #1 on: March 25, 2009, 02:14:06 am »
Quote
The most interesting thing is: the problem first appeared short after a successful compilation (I didn't restart Codeblocks).
Strange problem. You have tried Rebuild this project? It seems you are using ccl.exe, it is a compiler from VC++?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

mkd

  • Guest
Re: problem at compiling a project with wxWidgets
« Reply #2 on: March 25, 2009, 06:37:44 am »
Yeah, I rebuilded the whole project two or three times and no, it's MinGW not VC++. I installed the Codeblocks with MinGW package.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: problem at compiling a project with wxWidgets
« Reply #3 on: March 25, 2009, 06:50:25 am »
Yeah, I rebuilded the whole project two or three times and no, it's MinGW not VC++. I installed the Codeblocks with MinGW package.
which version of c::b do you use? nightly build? or 8.02? which mingw version? 3.45? or 4.x?
I have used wxPack before, but now, I manually build the wxWidgets library myself, it's not so hard.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: problem at compiling a project with wxWidgets
« Reply #4 on: March 25, 2009, 07:04:20 am »
Quote
cc1.exe: warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: not for GNU C

It seems you use a c-compiler.
wxWidgets needs c++.

Do you have files named *.c (that includes wxWidgets headers, either directly or via precompiled header) in your project, or did you (accidently) change your compiler toolchain ?

Make sure you have g++.exe or mingw32-g++.exe or whatever it is called as c++-compiler in the toolchain you use.

Do not try to include c++-headers (using classes) in c-files (c does not know classes).

C::B uses the fules suffix to decide whether a file is a c- or a c++-file.

mkd

  • Guest
Re: problem at compiling a project with wxWidgets
« Reply #5 on: March 25, 2009, 04:58:52 pm »
I don't have any *.c files in my project and in the Compiler Toolchain is g++ for *.cpp files. I think I'm going to reinstall Codeblocks and MinGW and see if it works then.

Thanks anyways,
mkd

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: problem at compiling a project with wxWidgets
« Reply #6 on: March 25, 2009, 05:16:01 pm »
I don't have any *.c files in my project and in the Compiler Toolchain is g++ for *.cpp files. I think I'm going to reinstall Codeblocks and MinGW and see if it works then.

Thanks anyways,
mkd

Before you do that, it would be nice if you can change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the appropriate content of the build log, that leads to this error.

mkd

  • Guest
Re: problem at compiling a project with wxWidgets
« Reply #7 on: March 25, 2009, 06:13:46 pm »
Before you do that, it would be nice if you can change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the appropriate content of the build log, that leads to this error.

Sorry, I already uninstalled Codeblocks :(.

I compiled wxWidgets myself and, atleast Codeblocks begins to compile, I don't know if this strange error will occur once more because, at the moment I'm facing a different problem. I have added these paths to the Compiler search directories and only my lib path to the Linker directories:



The errors I'm now getting are also on the image. The file is definitely existing! Path: "C:\Frameworks\wxWidgets-2.8.10\include\wx\msw".
Is there any way to compile a project with wxWidgets and not have all these paths under Search directories?


Greets,
mkd

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: problem at compiling a project with wxWidgets
« Reply #8 on: March 25, 2009, 08:00:21 pm »
The errors I'm now getting are also on the image. The file is definitely existing! Path: "C:\Frameworks\wxWidgets-2.8.10\include\wx\msw".
If you read carefully what the error tells you that you realise that the RESOURCE compiler complains (as you are compiling a resource here). Thus, add the compiler's include path's (as shown on the image) to the RESOURCE compiler include path's, too and you are done.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

mkd

  • Guest
Re: problem at compiling a project with wxWidgets
« Reply #9 on: March 25, 2009, 09:25:55 pm »
Ok, I finally found the problem. I told you wrong before, I had a *.c file in my project... the sqlite3 library...
I don't know why, but if I remove all the sqlite3 *.c files from the project it compiles well.

There's another problem. I think it's because I compiled wxWidgets on my own:
The program compiles but when I'm trying to run it, there's message box telling me that the "wxmsw28d_gcc_custom.dll" and "wxmsw28_gcc_custom.dll" are missing. Could it be about changed paths or something? May I fix this per hand or do I have to redo the project (or atleast create a new project and copy my files)?

Greets,
mkd

#edit: I just tried to create a new project with the wxWidgets wizard, this isn't working too. There's this message box telling me that there weren't found any matching files to compile a debug or release version.
« Last Edit: March 25, 2009, 09:34:42 pm by mkd »

mkd

  • Guest
Re: problem at compiling a project with wxWidgets
« Reply #10 on: April 01, 2009, 09:26:24 pm »
I solved the problem by building SQLite3 as static lib and linking the lib to my project instead auf compiling it.