Author Topic: Compile gtkm3 project on windows  (Read 3211 times)

Offline rebraoul

  • Single posting newcomer
  • *
  • Posts: 3
Compile gtkm3 project on windows
« on: January 30, 2019, 02:39:00 pm »
I'm struggeling in using gtkm3.0.
I've installed gtkm3.0 and pkg-config and MSys2 by strictly folowing https://wiki.gnome.org/Projects/gtkmm/MSWindows (pretty clear step by step).
Then I arrived upto the critical point to test with the proposed simple code  ::) and... it returns an error: "'mutex' does not name a type". Reading at some tuto on internet https://stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type but not only, I've discovered that this issue was cleared with the MinGw64 x64 as it handles threading. Then I installed MinGw64 x64 (with pacman -S mingw-w64-x86_64-gcc) and setup the correct compiler toolchain in C::B (or at least, I think I'm good on that point).
However, even doing all these steps I still have a collection of errors (see below the first lines but their are 20 of them) .
I may have missed something somewhere. Can someone guide me?

undefined reference to `___gxx_personality_sj0`
undefined reference to `___ZN4GLib7ustringD1Ev`
undefined reference to `___ZN3Gtk6WindowC1ENS_10WindowTypeE`

I'm kind of lost... Thank for your help,
....

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Compile gtkm3 project on windows
« Reply #1 on: January 30, 2019, 06:30:52 pm »
It looks like you are using the prebuild libraries but dont use the same compiler to build the final application. A pure guess from the names is that you either dont use the same exception model (SJLJ vs. DWARF) or dont use the same C++ version (pre c++11 vs. c++11 or newer).

Offline rebraoul

  • Single posting newcomer
  • *
  • Posts: 3
Re: Compile gtkm3 project on windows
« Reply #2 on: January 30, 2019, 08:40:09 pm »
Yes, I used a prebuilt library as it comes in package from pacman. But how can I know the compiler that was used.  I tried to change the compiler in compiler setting of C::B but none that tried worked. I'm using g++.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compile gtkm3 project on windows
« Reply #3 on: January 30, 2019, 09:47:38 pm »
Attach your project to this thread and I will see if it works for me. I am using MSys2, also.

Edit: No need for your project; I attached the one I created in the next post.

Post a build log of your project or of my project and we can try to see where the error is located.

Tim S.
« Last Edit: January 30, 2019, 10:43:42 pm by stahta01 »
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: Compile gtkm3 project on windows
« Reply #4 on: January 30, 2019, 10:27:23 pm »
Build log
Code
-------------- Build: Release in testgtkmm (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -Wall -mms-bitfields -pthread -mms-bitfields -IC:/msys64/mingw64/include/gtkmm-3.0 -IC:/msys64/mingw64/lib/gtkmm-3.0/include -IC:/msys64/mingw64/include/atkmm-1.6 -IC:/msys64/mingw64/include/gdkmm-3.0 -IC:/msys64/mingw64/lib/gdkmm-3.0/include -IC:/msys64/mingw64/include/giomm-2.4 -IC:/msys64/mingw64/lib/giomm-2.4/include -IC:/msys64/mingw64/include/pangomm-1.4 -IC:/msys64/mingw64/lib/pangomm-1.4/include -IC:/msys64/mingw64/include/glibmm-2.4 -IC:/msys64/mingw64/lib/glibmm-2.4/include -IC:/msys64/mingw64/include/gtk-3.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/pango-1.0 -IC:/msys64/mingw64/include/fribidi -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/atk-1.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/cairomm-1.0 -IC:/msys64/mingw64/lib/cairomm-1.0/include -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/sigc++-2.0 -IC:/msys64/mingw64/lib/sigc++-2.0/include -IC:/msys64/mingw64/include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/lib/libffi-3.2.1/include -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include -O2  -c C:\Users\stahta01\devel\open_source_code\no_version_control\test\testgtkmm\main.cpp -o obj\Release\main.o
x86_64-w64-mingw32-g++.exe  -o bin\Release\testgtkmm.exe obj\Release\main.o  -LC:/msys64/mingw64/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lz -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -s   -mwindows
Output file is bin\Release\testgtkmm.exe with size 20.00 KB
Process terminated with status 0 (0 minute(s), 7 second(s))
0 error(s), 0 warning(s) (0 minute(s), 7 second(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: Compile gtkm3 project on windows
« Reply #5 on: January 31, 2019, 12:04:24 am »
You will likely have to install mingw-w64-x86_64-pkg-config

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 rebraoul

  • Single posting newcomer
  • *
  • Posts: 3
Re: Compile gtkm3 project on windows
« Reply #6 on: January 31, 2019, 08:21:40 am »
Looking at your test code, it is exactly the same as the one I tested and return errors. Yours compiles and works, mine not... still returning the same errors. see below the log:

Code
-------------- Build: Debug in testgtkmm (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -Wall -mms-bitfields -pthread -mms-bitfields -IC:/dev/msys32/mingw64/include/gtkmm-3.0 -IC:/dev/msys32/mingw64/lib/gtkmm-3.0/include -IC:/dev/msys32/mingw64/include/atkmm-1.6 -IC:/dev/msys32/mingw64/include/gdkmm-3.0 -IC:/dev/msys32/mingw64/lib/gdkmm-3.0/include -IC:/dev/msys32/mingw64/include/giomm-2.4 -IC:/dev/msys32/mingw64/lib/giomm-2.4/include -IC:/dev/msys32/mingw64/include/pangomm-1.4 -IC:/dev/msys32/mingw64/lib/pangomm-1.4/include -IC:/dev/msys32/mingw64/include/glibmm-2.4 -IC:/dev/msys32/mingw64/lib/glibmm-2.4/include -IC:/dev/msys32/mingw64/include/gtk-3.0 -IC:/dev/msys32/mingw64/include/cairo -IC:/dev/msys32/mingw64/include -IC:/dev/msys32/mingw64/include/pango-1.0 -IC:/dev/msys32/mingw64/include/fribidi -IC:/dev/msys32/mingw64/include -IC:/dev/msys32/mingw64/include/atk-1.0 -IC:/dev/msys32/mingw64/include/cairo -IC:/dev/msys32/mingw64/include/cairomm-1.0 -IC:/dev/msys32/mingw64/lib/cairomm-1.0/include -IC:/dev/msys32/mingw64/include/cairo -IC:/dev/msys32/mingw64/include/pixman-1 -IC:/dev/msys32/mingw64/include -IC:/dev/msys32/mingw64/include/freetype2 -IC:/dev/msys32/mingw64/include -IC:/dev/msys32/mingw64/include/harfbuzz -I/mingw64/include -IC:/dev/msys32/mingw64/include/libpng16 -IC:/dev/msys32/mingw64/include/sigc++-2.0 -IC:/dev/msys32/mingw64/lib/sigc++-2.0/include -IC:/dev/msys32/mingw64/include/gdk-pixbuf-2.0 -IC:/dev/msys32/mingw64/include/libpng16 -IC:/dev/msys32/mingw64/include -IC:/dev/msys32/mingw64/lib/libffi-3.2.1/include -IC:/dev/msys32/mingw64/include/glib-2.0 -IC:/dev/msys32/mingw64/lib/glib-2.0/include -IC:/dev/msys32/mingw64/include -g -std=c++14 -m64 -IC:\dev\msys32\mingw64\include\gtkmm-3.0 -c C:\Work\Programmation\Essais\EssaiGtkmStahta01\main.cpp -o obj\Debug\main.o
x86_64-w64-mingw32-g++.exe -LC:\Work\Programmation\Pplot\plplot-5.14.0.tar\plplot-5.14.0 -o bin\Debug\testgtkmm.exe obj\Debug\main.o  -LC:/dev/msys32/mingw64/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lz -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl  -m64 

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compile gtkm3 project on windows
« Reply #7 on: January 31, 2019, 12:04:12 pm »
Looking at your test code, it is exactly the same as the one I tested and return errors. Yours compiles and works, mine not... still returning the same errors. see below the log:


I saw no error in the build log. What type of error are you getting? Build Error or Run-time error?

I suggest trying my project to see if it works for you.

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: Compile gtkm3 project on windows
« Reply #8 on: January 31, 2019, 12:08:08 pm »
Are you trying to build 64 bit or 32bit? Because you look like you are mixing them!

If building 64 bit, Uninstall msys2 32 bit and then install msys2 64 bit!

C:/dev/msys32

Edit: MSys2 64 bit can be used to create and run both 32 bit and 64 bit programs.
My guess is that MSys2 32 bit can be used to create 32 bit and 64 bit programs; but, can only run 32 bit programs.

Edit2: I have used an MSys2 64 bit installation to create 32 bit apps and it works rather well.
But, I have never tried using MSys2 32 bit installation to make 64 bit apps!

Tim S.
« Last Edit: January 31, 2019, 02:33:31 pm by stahta01 »
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