1

So i am new on the platform, i use c/c++ and i have interests in graph interfaces so i decided to use gtk+and gtkmm with visual studio. First, i downloaded gtk for the gnome project. I followed all the steps and i got this after a manual run :

\\\ test23.cpp
#include <gtkmm.h>

int main(int argc, char* argv[])
{
    Gtk::Main app(argc, argv);
    Gtk::Window fenetre;
    Gtk::Main::run(fenetre);
    return 0;
}


$ g++ -std=c++ test23.cpp $(pkg-config gtkmm-3.0 --cflags --libs | sed 's/ -I/ -isystem /g')
Package gtkmm-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-3.0' found
bash: g++: command not found

so i decided to install using vcpkg. But I failed to install gtk+ and gtkmm after multiple tries. Here what i've got :

C:\WINDOWS\system32>vcpkg install gtk
Computing installation plan...
The following packages will be built and installed:
    gtk[core]:x86-windows
  * harfbuzz[core,glib]:x86-windows
  * libepoxy[core]:x86-windows
  * pango[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x86-windows...
Starting package 1/4: libepoxy:x86-windows
Building package libepoxy[core]:x86-windows...
Could not locate cached archive: C:\Users\Manolo97233\AppData\Local\vcpkg\archives\f7\f743ec00b235ca7fd37812284b7d2e09d89b368a.zip
-- Using cached C:/Windows/SysWOW64/vcpkg/downloads/anholt-libepoxy-1.5.4.tar.gz
-- Cleaning sources at C:/Windows/SysWOW64/vcpkg/buildtrees/libepoxy/src/1.5.4-337c486045.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Windows/SysWOW64/vcpkg/downloads/anholt-libepoxy-1.5.4.tar.gz
-- Applying patch libepoxy-1.5.4_Add_call_convention_to_mock_function.patch
-- Using source at C:/Windows/SysWOW64/vcpkg/buildtrees/libepoxy/src/1.5.4-337c486045.clean
-- Acquiring MSYS Packages...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
    Command failed: C:/Windows/SysWOW64/vcpkg/downloads/tools/msys2/msys64/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --needed pkg-config"
    Working Directory: C:/Windows/SysWOW64/vcpkg/downloads/tools/msys2
    Error code: 1
    See logs for more information:
      C:\Windows\SysWOW64\vcpkg\buildtrees\libepoxy\msys-pacman-x86-windows-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_acquire_msys.cmake:127 (vcpkg_execute_required_process)
  scripts/cmake/vcpkg_configure_meson.cmake:106 (vcpkg_acquire_msys)
  ports/libepoxy/portfile.cmake:16 (vcpkg_configure_meson)
  scripts/ports.cmake:79 (include)

I believed i had a problem with msys2 so i tried to install it separately following an install kit unsuccessfully. then i tried to run separately other packages involved with gtkmm like pango and i got this :

//vcpkg install pango
Computing installation plan...
error writing file: C:\Windows\SysWOW64\vcpkg\buildtrees\0.vcpkg_dep_info.cmake: The data is invalid.

Someone explained on a topic it could be an vcpkg accessibility problem for others packages. i modified the accessibility of vcpkg for other packages in my systWOW64'file parameters but it went unsuccessful. I don't know if vcpkg is problem because i did not remove it and re install it.

I am looking for solutions/options, I am short on ideas, i literally need some help. Thanks

Manu LAB
  • 13
  • 5
  • Can you tell us exactly what you do when you attempt to install msys or other packages? There's a hundred ways to do it, so it's hard to tell what you're doing. Suppose we just logged in on Windows, what exact steps do you follow next? Be very precise please. – Kuba hasn't forgotten Monica Dec 22 '20 at 07:11

2 Answers2

0

Use JHbuild, its your friend when building GNOME applications from source !

Run jhbuild build gtkmm --nodeps, the built files will be installed in $HOME/jhbuild/build. To compile your application with it, you must export the environment variable PKG_CONFIG_PATH as follows:
export PKG_CONFIG_PATH="$HOME/jhbuild/build/lib/pkgconfig" (in the terminal you are running the g++ command from) And you have to install g++. I do not know how you are using bash together with visual studio, but if you have apt, you can install g++ and gtkmm with the following command :
apt install libgtkmm-3.0-dev libgstreamermm-1.0-dev g++ If you have already downloaded gtk, then the downloaded package must contain a .pc file. The directory this file is in when you installed the downloaded package you must add to the PKG_CONFIG_PATH.

TheEagle
  • 5,808
  • 3
  • 11
  • 39
0

Thanks Frederic for your answer it really help me.

I have got an other question. In my quest to add external packages to my C/C++ project, i read differents topics about how to convert static library (.a) into static library (.lib). I downloaded packages and i wanted to add them manually using their pathway.

I added my packages as followed:

1 / Add the path of the headers in the compiler directories for the project:

-> Project / Properties menu

-> On the left tree, choose Configuration properties - C / C ++ - General

-> On the right table, the first line "Other Include directories": add the directory (s) of your library containing the headers

2 / Add the path of the .lib in the compiler directories for the project:

-> Project / Properties menu

-> On the left tree, choose Configuration Properties - Link Editor - General

-> On the right table, the line "Directory of additional libraries": add the directory (s) of your library containing the .libs

3 / Specify the libraries with which your project is linked:

-> Project / Properties menu

-> On the left tree, choose Configuration Properties - Link Editor - Enter

-> On the right table, the first line "Additional dependencies": add the .lib library (s) with which your project must be linked

But I looked for .lib files to add to my linker input instead, I found .a files and .dll files and I didn't know what to do. . a files and .lib files are almost identical. It seems like .a files are used under linux while .lib are used under windows. I tried to add the .a files unsuccesfilly. I wondered if I could convert an .a file into a .lib file. Thanks

Manu LAB
  • 13
  • 5
  • I do not know how to convert .a files to .lib files, but you can use the .dll files instead. DLL files alraedy have the right format for Windows – TheEagle Jan 02 '21 at 17:36