News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

GTK in Code:Blocks (Windows 10)

Started by eric1708, October 22, 2020, 11:07:07 AM

Previous topic - Next topic

eric1708

Hi there,

After a serious Windows 10 crash, I had to re-format my disk and to re-install everything on my computer, but I remain unable to re-install GTK on Code:Blocks.

The version of Code:Blocks is the last one available (20.03) but I want to install the 2.24 version of GTK.

GTK is apparently correctly installed (after pkg-config; and gtk-demo works fine). I've correctly declared (I think) in Code:Blocks directories and libraries. However, I remain unable to compile my codes, and get the following error messages:

Quoteld.exe||cannot find -lgtk-win32-2.0| ld.exe||cannot find-lgobject-2.0| ld.exe||cannot find -lglib-2.0|

These libraries are in gtk/lib, which is declared in Code:Blocks.

This is now driving me crazy.. Especially since I've done that several times before without problems..

Thanks for any help on that & cheers,

Eric.

Miguel Gimenez


eric1708

Thanks for your reply.

Here it is:


-------------- Clean: Debug in test (compiler: GNU GCC Compiler)---------------

Cleaned "test - Debug"

-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------

gcc.exe -Wall -mms-bitfields -g -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\gtk-2.0 -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\cairo -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\gdk -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\glib-2.0 -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\lib\glib-2.0\include -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\pango-1.0 -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\lib\gtk-2.0\include -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\atk-1.0 -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk"\include\gdk-pixbuf-2.0 -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\gtk-2.0" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\cairo" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\glib-2.0" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\glib-2.0\include" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\pango-1.0" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\atk-1.0" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\include\gdk-pixbuf-2.0" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gtk-2.0\include" -I"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib" -c C:\Users\wajnberg\Desktop\test\main.c -o obj\Debug\main.o
gcc.exe -L"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib" -L"C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib" -o bin\Debug\test.exe obj\Debug\main.o   -lgtk-win32-2.0 -lgobject-2.0 -lglib-2.0 "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gobject-2.0.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\glib-2.0.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\pango-1.0.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gtk-win32-2.0.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gdk-win32-2.0.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\cairo.lib"
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgtk-win32-2.0.dll.a when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgtk-win32-2.0.dll.a when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgtk-win32-2.0.dll.a when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgtk-win32-2.0.dll.a when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gtk-win32-2.0.lib when searching for -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgtk-win32-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgobject-2.0.dll.a when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgobject-2.0.dll.a when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgobject-2.0.dll.a when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libgobject-2.0.dll.a when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\gobject-2.0.lib when searching for -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgobject-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libglib-2.0.dll.a when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libglib-2.0.dll.a when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libglib-2.0.dll.a when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/libglib-2.0.dll.a when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib/glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\gtk\lib\glib-2.0.lib when searching for -lglib-2.0
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglib-2.0
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
4 error(s), 0 warning(s) (0 minute(s), 1 second(s))


GTK is installed here: C:\Program Files (x86)\CodeBlocks\MinGW\gtk

Thanks in advance for your help!

Eric.

Miguel Gimenez

The "skipping incompatible library" error is shown because you are trying to link with libraries created with other compilers. The .lib are probably from Visual Studio and the .dll.a from other version or GCC (or the same version with different number of bits, 64 vs 32). You must create those libs with the same compiler and options used when compiling your program.

eric1708

Quote from: Miguel Gimenez on October 22, 2020, 12:14:29 PM
The "skipping incompatible library" error is shown because you are trying to link with libraries created with other compilers. The .lib are probably from Visual Studio and the .dll.a from other version or GCC (or the same version with different number of bits, 64 vs 32). You must create those libs with the same compiler and options used when compiling your program.
Thanks, but I do not see how this can be the explanation.

First of all, I'm not the one that compiled the GTK library. I took binaries already available for Windows. Second, as I said, I already installed this same GTK library on the same computer, with the same Windows version before, without any problem. So, I do not think the problem is coming from the library.

The only difference between what I did before, on the same machine, and what I'm trying to do now, is that I now use a new version (updated) of Code:Blocks, that maybe comes with a new version of gcc. For example, the GTK library is in 32 bits (I assume this is what the "win32" means), while I indeed install a 64 bits version of Code:Blocks. Can this be a possible explanation of the problem I have?

In all cases, thanks for your time and help on this.

Eric.

Miguel Gimenez

C::B 20.04 bundles a new compiler (minGW-64 vs TDM), and it seems incompatible with the one used to build the libraries. Probably the bundled compiler generates 64-bit object files by default, or the ABI is different. Check which compiler was used to build you prebuilt libraries or build your own.

eric1708

I can't know what compiler was used to build the GTK library that I have. I also can't built my own. It remains that, about two years ago, I was able to compile everything. For sure, at the time, the Code:Blocks version was different.

On the Code:Blocks "download" site, I just see that there is also a 32 bits version available (and I assume it comes with a 32 bits version of gcc). Do you think this could save me?

Again, thanks for your help.

Eric.

Miguel Gimenez

You can install any compiler and set C::B to use it, you just need some care setting the PATH variable if compiling out of C::B.

Where did you download the binaries from? May be you can get some compiler info there.

eric1708

I simply downloaded the bundle here: http://www.codeblocks.org/downloads/26 (from the CodeBlocks web site). There is a bundle that comes with a gcc version, all included.

Ok, I'll try to install the 32 bit version of this bundle and see what it gives.

I will report what it gives here.

Cheers, Eric.

Miguel Gimenez

Sorry for not being clear, I was asking for the origin of the GTK prebuilt libraries.

About C::B, I would do the following:
  - Uninstall C::B 20.03 and the bundled compiler
  - Install the last nightly build from http://forums.next.codeblocks.org/index.php/topic,24160.0.html
  - Download a compiler from https://sourceforge.net/projects/mingw-w64/files/ (select Toolchains targetting Win32 or Win64, depending on your needs)
  - Install the compiler in C:\MinGW
  - Configure GCC Compiler in C::B so it uses the new compiler

eric1708

Ok. The GTK library comes from here: http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/  (hence the file gtk+-bundle_2.24.10-20120208_win32.zip). I definitely need this particular one.

I'll try the chain of actions you proposes me.

Strange that the Code:Blocks bundle about two years ago was working, but the new one is not. Actually, I should say the gcc I've downloaded about two years ago, etc..

I will keep on reporting what it gives, here.

Eric.

eric1708

I never installed Code:Blocks like this. I've downloaded and extracted the zip (well 7Z) file indicated on the web page you gave me. But then? I can't run codeblocks.exe. What shall I do?

Alternatively, I know how to download Code:Blocks without a compiler. Shall I do that and then follow your procedure at step 3?

Again, thanks for your help on that.

Eric.

eric1708

In the meantime, I was able to find that everything was working before on my computer with Code:Blocks version 16.01, and I also discovered that this version is still available here: https://sourceforge.net/projects/codeblocks/files/Binaries/16.01/Windows/, including with a compiler.

I guess I simply should install that one, and everything should be solved..

No?

Eric.

eric1708

So, here is what I did:

I've finally installed the version 16.01 of Code:Blocks and everything works fine (finally!!).

So, the problem was indeed that the compiler - by default - provided in the bundle for Code:Blocks is a 64 bits version, while I was willing to link my codes with a 32 bits library.

This is fine, I should have notice this myself.

However, there remains a problem here:

If you go in the download page of Code:Blocks for the last version 20.03, you can still download a bundle for a 32 bit version, but there is no 32 bits version of gcc that comes with it. There is a mistake here, I think, and this should be said somewhere. No?

In all cases, the problem is solved (although with an old version of Code:Blocks).

Thanks for your help on this.

Cheers, Eric.

Miguel Gimenez

To install the nightly you must download and expand three 7z files, not one.

You can use the nightly with the compiler bundled with C::B 16.01 (TDM 5.1) without uninstalling 16.01.