Author Topic: Problems with configuration wxWidgets in C::B  (Read 6380 times)

Offline Tkachov

  • Single posting newcomer
  • *
  • Posts: 6
Problems with configuration wxWidgets in C::B
« on: January 22, 2012, 05:44:59 am »
Hello.

Tried to create simple application in C::B using wxWidgets.

First my problem was (yes, was - I'm talking about it just to provide more information about what I've done) with compiled exe-file. Running through IDE is allright, but running compiled one asks wxWidgets dlls. To solve it I've compiled wxWidgets myself using MinGW as static (SHARED=0), non-monolithic (MONOLITHIC=0) Release-configuration (BUILD=release) libraries.

And now I've got the second problem. The project I've done and compiled earlier couldn`t be compiled now; I`ve got about 700 errors like "undefined reference to `_imp___ZN16wxEventHashTableD1Ev'". (But I`ve changed path to new wxWidgets directory, corrected libraries names at Build options -> Linker settings.)

Also, default wxWidgets-project (one label, two buttons) can`t be compiled without libwxjpeg.a and libwxtiff.a now. But it`s strange, `cos it don`t uses it.

May be I`ve forgotten something and so this is a reason why I`ve got these errors?

P.S.: if this already was discussed, please, give me some links to the topics.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with configuration wxWidgets in C::B
« Reply #1 on: January 22, 2012, 02:36:28 pm »
Turn on "Full Compiler Logging" it sometimes will show up the problem.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Common causes of weird errors:
Using a different Compiler version to compile User App and wxWidgets Library.
Having two different version of wxWidgets Library in the search paths.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Tkachov

  • Single posting newcomer
  • *
  • Posts: 6
Re: Problems with configuration wxWidgets in C::B
« Reply #2 on: January 22, 2012, 04:22:38 pm »
Looks like I'm getting the same errors without new information.

I`ve compiled wxWidgets using the same compiler as I`m using at Code::Blocks and I`m sure I have only one version of these libraries.

There are also some info about undefined reference error at wxWidgets wiki: static libs must be given to compiler before shared libs. There are some libraries like lkernel32 and luser32 (and 11 others). I don`t know, are these libraries shared or not, so I`ve tried to change their position in compiler call and got no effect - same errors.

Also, I`ve used wxPack before getting first problem I`ve described there (compiled exe-file asks wxWidgets dll to be in the same directory). But, as I said, I`ve removed it and compiled static libraries instead (so there are shouldn`t be another versions of wxWidgets).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with configuration wxWidgets in C::B
« Reply #3 on: January 22, 2012, 04:26:24 pm »
And if you post the Full compiler build log, someone can help you understand them.
If you do not, then you will get no more help from me.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Tkachov

  • Single posting newcomer
  • *
  • Posts: 6
Re: Problems with configuration wxWidgets in C::B
« Reply #4 on: January 22, 2012, 04:43:22 pm »
This is not full build log for my project (there are 650 errors, undefined references like "_imp___ZN12wxStringBaseC2Ejc" and then error messages about libwxjpeg and libwxtiff like a default wxWidgets project provides):
Code
-------------- Build: Release in P ---------------
mingw32-g++.exe -LD:\CPP\IDE\wxWidgets\lib\gcc_lib  -o bin\Release\P.exe obj\Release\PMain.o obj\Release\PApp.o  obj\Release\resource.res  -s -mthreads  -lwxmsw28u_core -lwxbase28u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32  -mwindows
obj\Release\PMain.o:PMain.cpp:(.text+0x27): undefined reference to `_imp___ZN16wxEventHashTableD1Ev'
obj\Release\PMain.o:PMain.cpp:(.text+0x54): undefined reference to `_imp___ZN12wxStringBaseC2Ejc'
obj\Release\PMain.o:PMain.cpp:(.text+0xc2ec): undefined reference to `_imp___ZN6wxFontD1Ev'
obj\Release\PMain.o:PMain.cpp:(.text$_ZNK12wxWindowBase7GetNameEv[wxWindowBase::GetName() const]+0x2a): undefined reference to `_imp__wxEmptyString'
obj\Release\PMain.o:PMain.cpp:(.text$_ZN12wxButtonBaseD0Ev[wxButtonBase::~wxButtonBase()]+0xb): undefined reference to `_imp___ZTV12wxButtonBase'
obj\Release\PMain.o:PMain.cpp:(.text$_ZN12wxButtonBaseD0Ev[wxButtonBase::~wxButtonBase()]+0x19): undefined reference to `_imp___ZN9wxControlD2Ev'
obj\Release\PMain.o:PMain.cpp:(.text$_ZN12wxButtonBaseD1Ev[wxButtonBase::~wxButtonBase()]+0xb): undefined reference to `_imp___ZTV12wxButtonBase'
obj\Release\PMain.o:PMain.cpp:(.text$_ZN12wxButtonBaseD1Ev[wxButtonBase::~wxButtonBase()]+0x15): undefined reference to `_imp___ZN9wxControlD2Ev'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x2c0): undefined reference to `jpeg_resync_to_restart'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0x3a2): undefined reference to `jpeg_std_error'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xcd8): undefined reference to `jpeg_finish_compress'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xce0): undefined reference to `jpeg_destroy_compress'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagjpeg.o):imagjpeg.cpp:(.text+0xdfc): undefined reference to `jpeg_set_quality'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x287): undefined reference to `TIFFClientOpen'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xfeb): undefined reference to `TIFFWriteScanline'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x10a9): undefined reference to `_TIFFfree'
D:\CPP\IDE\wxWidgets\lib\gcc_lib/libwxmsw28u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0x118a): undefined reference to `TIFFClose'

(Full log in attachment.)

____________

UPD: tired to compile a default wxWidgets project using wxPack (got my libraries out of search directories and then installed wxPack). If I'm using static non-monolithic libraries from wxPack, it gives me the same errors.
« Last Edit: January 22, 2012, 04:59:29 pm by Tkachov »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with configuration wxWidgets in C::B
« Reply #5 on: January 22, 2012, 07:18:52 pm »
Code
mingw32-g++.exe -LD:\CPP\IDE\wxWidgets\lib\gcc_lib  -o bin\Release\P.exe obj\Release\PMain.o obj\Release\PApp.o  obj\Release\resource.res  -s -mthreads  -lwxmsw28u_core -lwxbase28u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32  -mwindows

The above is the Link Command; The compile command(s) was not in your post.
I suggest doing a re-build of your project and posting the full compiler log of the complete build.

I also suggest linking the libraries needed.
If you do NOT wish to use the "jpeg" library for a real reason then ask how to do so at wxforum.
Else, link it to get rid of some of the linker errors.

NOTE: The libraries can fail to work if they are in the wrong order!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with configuration wxWidgets in C::B
« Reply #6 on: January 22, 2012, 07:25:05 pm »
I suggest going to wxForum http://forums.wxwidgets.org/ and asking your question there because so far I see nothing that looks to be a Code::Blocks issue.

NOTE: Without the full compiler build log I can not be sure!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Tkachov

  • Single posting newcomer
  • *
  • Posts: 6
Re: Problems with configuration wxWidgets in C::B
« Reply #7 on: January 23, 2012, 07:34:48 am »
Something has changed and now it don`t gives these errors. Few more words down there, but I don`t sure I`ve solved this problem already.

The above is the Link Command; The compile command(s) was not in your post.
I suggest doing a re-build of your project and posting the full compiler log of the complete build.

Yes, link command is the only thing that have appeared in compiler log. And this log you can see above (full in attachment, pieces in my post) is a compiler log of the complete rebuild... Wait. Really, I`ve forgotten few lines...

I also suggest linking the libraries needed.
If you do NOT wish to use the "jpeg" library for a real reason then ask how to do so at wxforum.
Else, link it to get rid of some of the linker errors.

There are no reason not to use jpeg and tiff libraries except increasing executable size. I mean, these libraries shouldn`t be used in the project, but compiler wants it to be there and so executable becomes larger.
But I`ll try to link it and rebuild project.

NOTE: The libraries can fail to work if they are in the wrong order!

In that article on wxWidgets wiki this is the reason of undefined references, but it takes no effect - same errors even if I change the order.

Also, I`ll ask about this issue on wxForum (actually, I`ve asked it in the international discussion forum - that`s why I`ve compiled wxWidgets library myself and got new problem with compiling a project using static libraries instead first one with DLLs).

______________________________________

Forget anything I`ve told. I don`t know, what have changed, but today I`ve got 21 new errors instead of 650 errors yesterday. And these errors are not about undefined references with strange names, but... I just will try to solve these by myself.

If I`ll got something about this problem again (for example, if the old ones appear again when I`ll solve new errors) - I`ll post here. And if not - I`ll post, that problem is solved.

(Also, default project still asks libwxjpeg and libwxtiff. That project I haven`t changed don`t even asks for it now.)

Guess why it don`t show old errors - these new errors are about compiling cpp-file into o-file (nothing in file has changed, but now it don`t want to be compiled =) and not about compiling executable. May be if I`ll solve these errors, I`ll got old ones again, so I`ll create this project again (it`s small enough to be recreated in few hours or even in one hour) and may be it would be allright. If not... I`ll ask about it on wxForum first =)
« Last Edit: January 23, 2012, 08:14:15 am by Tkachov »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with configuration wxWidgets in C::B
« Reply #8 on: January 23, 2012, 09:41:11 am »
You need to learn the difference between "build" and "re-build".
This is not exactly true; but, I do NOT have time to teach basic programming and it is off topic on this site.

Build: Start where it failed last time and also do all the files that have dates newer than last time.
Re-Build: Start at the beginning and compile all the files not just ones that were modified.

It is always recommended to do a re-build after changing any project options like search directory!

Tim S.  
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Tkachov

  • Single posting newcomer
  • *
  • Posts: 6
Re: Problems with configuration wxWidgets in C::B
« Reply #9 on: January 23, 2012, 09:52:33 am »
Thanks, but I know the difference, and I`ve re-builded project every time I made some changes in project options (just I`ve copied only part with executable build log).
And, of course, I`m usually using building to apply a changes I`ve made in code.

Again, I don`t really know what happen - re-building yesterday was allright on cpp- and rc-files, but failed on compiling executable. Now there are few errors about cpp-file.

But thank you anyway.
« Last Edit: January 23, 2012, 09:55:14 am by Tkachov »