gtk 질문입니다.

nayana의 이미지

#include <gtk/gtk.h>

int main (int argc, char *argv[])
{
    GtkWidget *window;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show (window);

    gtk_main ();

    return 0;
}

이번에 영유가 있어서 gtk를 공부를 하려고 합니다.
위의 코드는 위키에 있는 코드를 그대로 가지고 온겁니다.
gcc -o a a.c 컴파일하니 다음과 같은 오류가 나옵니다.
a.c:1:21: gtk/gtk.h: 그런 파일이나 디렉토리가 없음
a.c: In function `main':
a.c:5: error: `GtkWidget' undeclared (first use in this function)
a.c:5: error: (Each undeclared identifier is reported only once
a.c:5: error: for each function it appears in.)
a.c:5: error: `window' undeclared (first use in this function)
a.c:9: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)

컴파일 할때 옵션을 어떻게줘야 하나요?
그리고 gtk.h파일은 제 시스템에서는 /usr/include/gtk-2.0/gtk/gtk.h
이런식으로 있습니다. gtk.h 헤더파일을 쓸려면 어떻게 해야하죠?

Prentice의 이미지

http://wiki.kldp.org/wiki.php/LinuxdocSgml/GtkTutorial-TRANS

말고

http://www.gtk.org/tutorial/sec-compiling.html

여기를 보니 pkg-config를 설치하신 후

gcc -Wall -g a.c -o a `pkg-config --cflags gtk+-2.0` \
`pkg-config --libs gtk+-2.0`

이런 식으로 하셔야 할 것 같습니다.

nohmad의 이미지

개발툴을 설치하셨다면 아마 gtk-config도 설치되었을 것입니다.

$ gtk-config --cflags --libs

위 명령을 실행해보시면 어떻게 컴파일해야 하는지 알려줄 것입니다. 보통 위 명령을 백틱(`)으로 감싸서 컴파일러에 전달하죠.

ckebabo의 이미지

nohmad wrote:
보통 위 명령을 백틱(`)으로 감싸서 컴파일러에 전달하죠.

윈도우즈의 프롬프트창에서도 ``로 감싸서 전달하는 것과 같은 효과를 얻는 방법이 없을까요?

eungkyu의 이미지

ckebabo wrote:
nohmad wrote:
보통 위 명령을 백틱(`)으로 감싸서 컴파일러에 전달하죠.

윈도우즈의 프롬프트창에서도 ``로 감싸서 전달하는 것과 같은 효과를 얻는 방법이 없을까요?

windows용 bash같은걸 까는건 어떠신지요?

nohmad의 이미지

ckebabo wrote:
nohmad wrote:
보통 위 명령을 백틱(`)으로 감싸서 컴파일러에 전달하죠.

윈도우즈의 프롬프트창에서도 ``로 감싸서 전달하는 것과 같은 효과를 얻는 방법이 없을까요?

gtk-config의 결과를 Makefile에 기록한 다음에 make로 컴파일하는 것이 좋을 것 같군요.

nayana의 이미지

유용한 정보 감사합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.