jongwon.kwak
jongwon.kwak

Reputation: 163

How can I build glib at c++ - compile error when build .cpp

All

When I build cpp using g++ and glib, I meet compile error. c and gcc version is OK. I'm building at Ubuntu 10.XX. I even built it at windows - c++.

How can I build glib at c++? Thanks you.

#include <glib.h>

int main() {
    g_printf("test");
    return 0;
}

jongwon_kwak@kwak-com:~/worksapce_CXX/TESTGLib/src$ g++ -c -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include TESTGLib.cpp 
TESTGLib.cpp: In function ‘int main()’:
TESTGLib.cpp:12:17: error: ‘g_printf’ was not declared in this scope

Upvotes: 0

Views: 1096

Answers (2)

Hafiz Muhammad Shafiq
Hafiz Muhammad Shafiq

Reputation: 8670

Just edit this and it will work

#include <glib/gprintf.h>

Upvotes: 0

Valerij
Valerij

Reputation: 27738

you are missing #include <glib/gprintf.h>

Upvotes: 1

Related Questions