GTK3 e MSYS2 compiling data - c

i've installed in my windows 10 system GTK3.0 for mingw64 by MSYS2 but i've got a problem with pkg-config. When i write in the shell:
$ pkg-config --cflags --libs gtk+-3.0
I got the following error:
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk+-3.0', required by 'virtual:world', not found
What's the deal?

Related

How to build an executable file cross platform from linux to windows?

I wrote a GTK3+ project in c , and i am trying to build it so i can make it into a executable file for windows , and i have no idea on how to do it , i saw some articles about building .exe files using MingW so i tried it as such :
x86_64-w64-mingw32-gcc -g -o test PROJECT_INTERFACE.c PROJECT.c pkg-config --libs gtk+-3.0 pkg-config --cflags gtk+-3.0
but i get this error message :
error
can someone help me with building this project for end-user?

How to use kplot (Cairo plotting library) without installing it

kplot is a UNIX programming library for plotting graphs on a Cairo surface. The source code is available here.
After downloading the source code I extraced it to the directory kplot-master and cd into it. Simple ls now shows
array.c
border.c
bucket.c
buffer.c
....
example0.c
example1.c
....
I am using Ubuntu 14.04 LTS. Cairo is installed in my system and I tested it by successfully compiling C codes available in [zetcode dot com slash gfx slash cairo slash cairobackends slash] (Sorry as I am not allowed to link more than two).
I am new to GTK and Cairo plotting library and would like help in the following directions:
I do not want to install kplot in my system.
I just want to learn how kplot uses Cairo.
When I use the following command:
gcc example0.c -o example `pkg-config --cflags --libs gtk+-3.0`
it produces the following error message:
example0.c:17:20: fatal error: compat.h: No such file or directory
#include "compat.h"
^
compilation terminated.
It will be very helpful if somebody shows me how to test those kplot examples without installing it.
There is no need to install.
First you will need to compile the kplot library. For that, cd to the kplot directory and run a make command. This will generate the file compat.h. After that you will be able to compile example by example with make example(n) command, or with gcc example(n).c -o example(n) `pkg-config --cflags --libs gtk+-3.0` libkplot.a -lbsd -lm command.
If you have GTK+-3.0 and Cairo dev libraries installed, everything should go well.

Not able to compile GTK3+ program on windows

I am using MinGW and I have set the path for the same in the Environment Variables. I have also set the path for GTK in the Environment Variables.
MInGW has been set up successfully since I am able to use the gcc commands to compile regular C programs.
Even GTK has been set up successfully (confirmed by entering pkg-config --cflags gtk+-3.0 in cmd which prints out a list of variables and also ran a already compiled GTK application succesfully).
I have also set the path for pkgconfig in the Environment Variables.
Variable Name-PKG_CONFIG_PATH and Value-C:\gtk\lib\pkgconfig
Even after the complete set up, there are some errors which occur when I try compiling a GTK program.
Command used:
gcc hello.c -o hello 'pkg-config --cflags --libs gtk+-3.0'
Note: I have used ` in the actual command and not '(used ' here to prevent highlighting).
Errors:
pkg-config no such directory found.
gtk+-3.0 no such directory found
unrecognized command line option --cflags unrecognized command line
option --labs
Tools I tried:
Windows cmd
MingW Shell
MSYS2
Cygwin Terminal (I haven't set up Cygwin path in the environment variables to prevent errors between Cygwin and MingW)
Can someone help me in figuring out what's the actual issue even after completing all the set up steps I mentioned above? Please help me!
Forums I already checked out:
Compiling and running GTK+ application on Windows 7
http://www.tarnyko.net/repo/gtk3_build_system/tutorial/gtk3_tutorial.htm
And more...But nothing has helped me so far!
So I understand you have been using:
gcc hello.c -o hello `pkg-config --cflags --libs gtk+-3.0`
You appear to be trying to be clever with pkg-config. Have you tried using --libs & --cflags separately?
e.g.:
gcc `pkg-config --cflags gtk+-3.0` -o hello hello.c `pkg-config --libs gtk+-3.0`
For more info see here

How to link librsync (which might have used libtool)

Just installed librsync using apt-get install librsync-dev on ubuntu. I can link other libraries like this pkg-config --libs --cflags glib-2.0 but I can't find librsync using pkg-config. How can I link it?
UPDATE: I very new to C and all this compiling linking stuff. Just learned how to find and link using pkg-config. But this librsync seems to be developed using different thing.
Your problem is not with C. The problem is most likely due to librsync NOT providing a package config file. Try:
pkg-config --list-all | grep -i rsync
If you get no response, librsync has no pkgconfig file available to the system. Instead of using pkg-config to link librsync, just add -lrsync to your gcc command line. E.g.:
gcc -Wall -o mynewprog mynewprog.c -lrsync

GStreamer: No such file or directory

I am working on a project that I need to display video to a window. So I do some research and find out GStreamer lib is probably a good way to go since I have a GUI written with GTK. However, after 2 hours trying to install and compile GStream on my Mac, I still get:
error: gts/gts.h: No such file or directory
What I did is install Gstreamer SDK for Mac OS from the official website. Export path:
export PATH=/Library/Frameworks/GStreamer.framework/Version/0.10/Headers:$PATH
Compile:
gcc test.c `pkg-config --cflags --libs gtk+-2.0` `pkg-config --cflags --libs gtk-1.0`
But I have no luck!. Please help!!!
First of all: You can't specify GCC's include path using the PATH variable. Its sole purpose is for the shell (or to be more specific: for the various flavors of exec()) to find executables you want to run.
You might want to modify your gcc command line like that (gstreamer-0.10 instead of gst-0.10):
gcc test.c `pkg-config --cflags --libs gtk+-2.0 gtk-1.0 gstreamer-0.10`
If that still doesn't work, look at the output of the pkgconfig command (by running it alone):
pkg-config --cflags --libs gtk+-2.0 gtk-1.0 gstreamer-0.10
That should give you either a list of gcc flags or an error message that should help you resolve your issue.

Resources