- Печать
Страницы: [1] Вниз
Тема: #include <glib.h> почемуто не подключаэтса билд есенс есть а штоже делать? (Прочитано 5652 раз)
0 Пользователей и 1 Гость просматривают эту тему.

merl

ziv
Думаю, что нужно установить libglib-dev.

merl
щ попробуэм ….

merl
почти получилось вопервых оно мне дало не glib а libglib1.2
и щяс вот такая ситуацыя….. я пока новичьок в линуксе и темболиэ в програмировании может хто подскажыт как ево заставить работать
root@akva:/home/andriy/Desktop# locate glib.h
/usr/include/glib-1.2/glib.h
/usr/share/doc/libglib1.2-dev/glib.html
root@akva:/home/andriy/Desktop# g++ b.c -o b
b.c:4:18: error: glib.h: No such file or directory
b.c: In function ‘int main()’:
b.c:261: error: ‘guint32’ was not declared in this scope
b.c:261: error: ‘g_rand_new_with_seed’ was not declared in this scope

S.Tokarev
g++ -c b.c -o b -I/usr/include/glib-1.2
Или лучьше в самом файле b.c
#include <glib-1.2/glib.h>
« Последнее редактирование: 15 Июля 2008, 21:29:50 от S.Tokarev »

Yurror
Есть вариант из учебника по glib
g++ -c b.c -o b.o `pkg-config —cflags glib-2.0`
Естественно это только компиляция. для линковки потребуется что-то вроде
g++ -o b b.o `pkg-config —libs glib-2.0`
P.S. конечно 2.0 надо заменить на вашу версию

merl
ну всьо я полностью запутался файл который я щя компилю содержит только фактичиски
#include <glib.h>
когда я прошу систему найти glib она ево видит, когда в сишном файле или при компиляции я прописую к нему путь
root@akva:/home/andriy/Desktop# g++ b.c -o b.o -I/usr/include/glib-1.2
или в файле
#include <glib-1.2/glib.h>
получаю вот штото такоэ непонятное:
root@akva:/home/andriy/Desktop# g++ b.c -o b.o -I/usr/include/glib-1.2
У файлі включеному з b.c:4:
/usr/include/glib-1.2/glib.h:66:24: error: glibconfig.h: No such file or directory
In file included from b.c:4:
/usr/include/glib-1.2/glib.h:502: error: ‘gint32’ does not name a type
/usr/include/glib-1.2/glib.h:503: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:504: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:505: error: ‘gint32’ does not name a type
/usr/include/glib-1.2/glib.h:769: error: typedef ‘GDataForeachFunc’ is initialised (use __typeof__ instead)
/usr/include/glib-1.2/glib.h:769: error: ‘GQuark’ was not declared in this scope
/usr/include/glib-1.2/glib.h:770: error: expected primary-expression before ‘data’
/usr/include/glib-1.2/glib.h:771: error: expected primary-expression before ‘user_data’
/usr/include/glib-1.2/glib.h:840: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:840: error: expected ‘;’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1573: warning: ‘g_bit_nth_lsf’ initialised and declared ‘extern’
/usr/include/glib-1.2/glib.h:1573: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1574: error: expected primary-expression before ‘nth_bit’
/usr/include/glib-1.2/glib.h:1574: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:1591: warning: ‘g_bit_nth_msf’ initialised and declared ‘extern’
/usr/include/glib-1.2/glib.h:1591: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1592: error: expected primary-expression before ‘nth_bit’
/usr/include/glib-1.2/glib.h:1592: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:1737: error: expected ‘,’ or ‘…’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1738: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:1740: error: expected ‘,’ or ‘…’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1741: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:1773: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1774: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1775: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1776: error: ‘GQuark’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1785: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1787: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1791: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1793: error: ‘GDataForeachFunc’ has not been declared
/usr/include/glib-1.2/glib.h:1816: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1818: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1822: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1824: error: ‘GDataForeachFunc’ has not been declared
/usr/include/glib-1.2/glib.h:2094: error: ‘guint16’ does not name a type
/usr/include/glib-1.2/glib.h:2095: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2168: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2169: error: expected primary-expression before ‘month’
/usr/include/glib-1.2/glib.h:2170: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2170: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:2171: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2180: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2182: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2184: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2185: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2186: error: expected primary-expression before ‘month’
/usr/include/glib-1.2/glib.h:2187: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2187: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:2191: error: ‘GDateYear’ does not name a type
/usr/include/glib-1.2/glib.h:2192: error: ‘GDateDay’ does not name a type
/usr/include/glib-1.2/glib.h:2193: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:2219: error: ‘GTime’ has not been declared
/usr/include/glib-1.2/glib.h:2223: error: ‘GDateDay’ has not been declared
/usr/include/glib-1.2/glib.h:2225: error: ‘GDateYear’ has not been declared
/usr/include/glib-1.2/glib.h:2227: error: ‘GDateDay’ has not been declared
/usr/include/glib-1.2/glib.h:2229: error: ‘GDateYear’ has not been declared
/usr/include/glib-1.2/glib.h:2231: error: ‘guint32’ has not been declared
/usr/include/glib-1.2/glib.h:2252: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2253: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2255: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2256: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2267: error: ‘gsize’ does not name a type
/usr/include/glib-1.2/glib.h:2354: error: expected `}’ before ‘GLIB_SYSDEF_POLLIN’
/usr/include/glib-1.2/glib.h:2355: error: expected initializer before ‘GLIB_SYSDEF_POLLOUT’
/usr/include/glib-1.2/glib.h:2360: error: expected constructor, destructor, or type conversion before ‘;’ token
/usr/include/glib-1.2/glib.h:2370: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2388: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2412: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2417: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2823: error: expected declaration before ‘}’ token
или когда я делаю вот так то ето меня воще выбивает из понимания слова «почему»
root@akva:/home/andriy/Desktop# g++ -c b.c -o b.o ‘pkg-config —cflags glib1-2’
g++: pkg-config —cflags glib1-2: No such file or directory
b.c:4:18: error: glib.h: No such file or directory
я не настолько опытен штоб понять в чьом здесь што

Kwah
Сдаётся мне, что библиотека, которую ты поставил старовата.
$ aptitude search libglib | grep dev
v libglib-dev —
p libglib-java-dev — GLib bindings for Java (development files)
p libglib1.2-dev — The GLib library of C routines (developmen
p libglib2.0-dev — Development files for the GLib library
p libglibmm-2.4-dev — C++ wrapper for the GLib toolkit (developm
А под рутом сидеть — это теперь такой экстремальный вид спорта?

S.Tokarev
или когда я делаю вот так то ето меня воще выбивает из понимания слова «почему»
root@akva:/home/andriy/Desktop# g++ -c b.c -o b.o ‘pkg-config —cflags glib1-2’
Апострофы не в ту сторону. Надо не ‘ , а `
Но правильно будет
g++ -c b.c -o b.o `glib-config —cflags`
g++ b.o -o b.exe `glib-config —libs`
« Последнее редактирование: 16 Июля 2008, 13:56:55 от S.Tokarev »

Yurror
Дожились… люди «копипастить» не умеют.
Скоро реально на прилавках появятся книжки типа «Клавиатура для идиотов» или «Мышка для даунов»
нужный апостроф находится на букве Ё, прямо под клавишей Esc, слева от 1, над клавишей Tab. Набирается легко и просто без всяких шифтов и прочей лабуды в английской раскладке
- Печать
Страницы: [1] Вверх
������������� ������� ��������� ��������� ���������� (man-��)
Glib::Error (3)
NAME
Glib::Error - Exception Objects based on GError
SYNOPSIS
eval { my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file ($filename); $image->set_from_pixbuf ($pixbuf); }; if ($@) { print "$@n"; if (Glib::Error::matches ($@, 'Gtk2::Gdk::Pixbuf::Error', 'unknown-format')) { change_format_and_try_again (); } elsif (Glib::Error::matches ($@, 'Glib::File::Error', 'noent')) { change_source_dir_and_try_again (); } else { # don't know how to handle this die $@; } }
DESCRIPTION
Gtk2-Perl translates GLib’s GError runtime errors into Perl exceptions, by
creating exception objects based on Glib::Error. Glib::Error overloads the
stringification operator, so a Glib::Error object will act like a string if
used with print() or warn(), so most code using $@ will not even know the
difference.
The point of having exception objects, however, is that the error messages
in GErrors are often localized with NLS translation. Thus, it’s not good
for your code to attempt to handle errors by string matching on the the
error message. Glib::Error provides a way to get to the deterministic
error code.
You will typically deal with objects that inherit from Glib::Error, such as
Glib::Convert::Error, Glib::File::Error, Gtk2::Gdk::Pixbuf::Error, etc; these
classes are provided by the libraries that define the error domains. However,
it is possible to get a base Glib::Error when the bindings encounter an unknown
or unbound error domain. The interface used here degrades nicely in such a
situation, but in general you should submit a bug report to the binding
maintainer if you get such an exception.
METHODS
scalar = Glib::Error::new ($class, $code, $message)
scalar = $class->new ($code, $message)
-
- * $code (GEnum) an enumeration value, depends on $class
- * $message (string)
-
Create a new exception object of type $class, where $class is associated
with a GError domain. $code should be a value from the enumeration type
associated with this error domain. $message can be anything you like, but
should explain what happened from the point of view of a user.
integer = $error->code
This is the numeric error code. Normally, you’ll want to use «value» instead,
for readability.
string = $error->domain
-
The error domain. You normally do not need this, as the object will be blessed
into a corresponding class.
string = $error->location
The source line and file closest to the emission of the exception, in the same
format that you’d get from croak() or die().
boolean = $error->matches ($domain, $code)
-
- * $domain (string)
- * $code (scalar)
-
Returns true if the exception in $error matches the given $domain and
$code. $domain may be a class name or domain quark (that is, the real
string used in C). $code may be an integer value or an enum nickname;
the enum type depends on the value of $domain.
string = $error->message
-
The error message. This may be localized, as it is intended to be shown to a
user.
Glib::Error::register ($package, $enum_package)
-
- * $package (string) class name to register as a Glib::Error.
- * $enum_package (string) class name of the enum type to use for this domain’s error codes.
-
Register a new error domain. Glib::Error will be added @package::ISA for
you. enum_package must be a valid Glib::Enum type, either from a C library
or registered with «Glib::Type::register_enum». After registering an
error domain, you can create or throw exceptions of this type.
scalar = Glib::Error::throw ($class, $code, $message)
scalar = $class->throw ($code, $message)
-
- * $code (GEnum) an enumeration value, depends on $class
- * $message (string)
-
Throw an exception with a Glib::Error exception object.
Equivalent to «croak (Glib::Error::new ($class, $code, $message));».
string = $error->value
The enumeration value nickname of the integer value in «$error->code»,
according to this error domain. This will not be available if the error
object is a base Glib::Error, because the bindings will have no idea how to
get to the correct nickname.
ENUMS AND FLAGS
enum GEnum
SEE ALSO
Glib
COPYRIGHT
Copyright (C) 2003-2007 by the gtk2-perl team.
This software is licensed under the LGPL. See Glib for a full notice.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- scalar = Glib::Error::new ($class, $code, $message)
- scalar = $class->new ($code, $message)
- integer = $error->code
- string = $error->domain
- string = $error->location
- boolean = $error->matches ($domain, $code)
- string = $error->message
- Glib::Error::register ($package, $enum_package)
- scalar = Glib::Error::throw ($class, $code, $message)
- scalar = $class->throw ($code, $message)
- string = $error->value
- ENUMS AND FLAGS
- enum GEnum
- SEE ALSO
- COPYRIGHT
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- New to Ubuntu
- [SOLVED] No package ‘glib-2.0’ found?
-
No package ‘glib-2.0’ found?
I’m trying to compile kildclient 2.10.0 on 32-bit Ubuntu 10.10. When i type ./configure I get the following error:
Code:
checking for GTK... no configure: error: Package requirements (glib-2.0 >= 2.14.0 gthread-2.0 >= 2.10.0 gtk+-2.0 >= 2.18.0) were not met: No package 'glib-2.0' found No package 'gthread-2.0' found No package 'gtk+-2.0' found
What do I need to install to fix this? I’ve got ubuntu-dev-tools installed.
EDIT: Solved — had to install libgtk2.0-dev
Last edited by Flynsarmy; October 28th, 2010 at 06:20 AM.
-
Re: No package ‘glib-2.0’ found?
That produced one further error for me, after a lot of searching, I found another thing that was missing (compiling for Ubuntu 10.10)
The following additional two commands worked for me:
sudo apt-get install libperl-dev
sudo apt-get install libgtk2.0-devHope this helps someone.
-
Re: No package ‘glib-2.0’ found?
Originally Posted by Cajhne
That produced one further error for me, after a lot of searching, I found another thing that was missing (compiling for Ubuntu 10.10)
The following additional two commands worked for me:
sudo apt-get install libperl-dev
sudo apt-get install libgtk2.0-devHope this helps someone.
That worked, thanks a lot.
-
Re: No package ‘glib-2.0’ found?
Bookmarks
Bookmarks

Posting Permissions
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Comments
hi, @dusty-nv, when i make, i meet this problem, but i can’t fix it, can you do me a favor?
/usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or directory
thanks.
i chance «/usr/include/glib-2.0» to «/usr/lib/x86_64-linux-gnu/glib-2.0/include», so it can make it successfully.
sudo cp /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glibconfig.h
fuomag9, alexmercerind, leflores-fisi, and anvouk reacted with heart emoji
gcc pkg-config --cflags glib-2.0
test.c pkg-config --libs glib-2.0
it’s useful
pphhss, wenlibin02, and jackw1111 reacted with laugh emoji
pphhss, wenlibin02, and jackw1111 reacted with hooray emoji
pphhss, wenlibin02, jackw1111, IG-88-2, and loudedtwist reacted with heart emoji
wenlibin02, jackw1111, and MiguelSantaCruz reacted with rocket emoji
sudo cp /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glibconfig.h
this worked (I had the same problem on a different VS Code project), however, I think a more idiomatic approach would be to use a symlink (sudo ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/
).
At vistual studio code in the «Include path» of C compiler i needed to place the lines in this excatly oder:
${workspaceFolder}/** /usr/include/glib-2.0/** /usr/include/gstreamer-1.0/**
the /** is important to do recursive search in the folders
sudo cp /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glibconfig.h
Mine was in /usr/lib/glib-2.0/include