Author Topic: build a simple gcc,got error:gtk/gtk.h: No such file or directory  (Read 3250 times)

gnosy

  • Guest
my foo.c:
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
    GtkWidget *window;
    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "hello");
    gtk_widget_show(window);
    gtk_main();
    return 0;
}
error:
C:\msys\1.0\home\Administrator\foo.c|1|gtk/gtk.h: No such file or directory|
C:\msys\1.0\home\Administrator\foo.c||In function `main':|
C:\msys\1.0\home\Administrator\foo.c|3|error: `GtkWidget' undeclared (first use in this function)|
C:\msys\1.0\home\Administrator\foo.c|3|error: (Each undeclared identifier is reported only once|
C:\msys\1.0\home\Administrator\foo.c|3|error: for each function it appears in.)|
C:\msys\1.0\home\Administrator\foo.c|3|error: `window' undeclared (first use in this function)|
C:\msys\1.0\home\Administrator\foo.c|5|error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)|
||=== Build finished: 6 errors, 0 warnings ===|

thanks in advance!
gnosy

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: build a simple gcc,got error:gtk/gtk.h: No such file or directory
« Reply #1 on: November 01, 2009, 09:26:14 am »
This is NOT a general programming forum, and we do NOT provide support for any specific libraries (other than the Code::Blocks SDK).

Please ask your question in a relevant forum, mailing list or IRC channel ONLY after you have searched for it in a search engine (Google is a very good one) without finding an answer.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 4474
    • My Best Post
Re: build a simple gcc,got error:gtk/gtk.h: No such file or directory
« Reply #2 on: November 01, 2009, 05:50:49 pm »
FYI:

C++ files are required to have the extension .cpp when using Code::Blocks.

Note: The above is just one of your problems; most likely need to add search directories inside Code::Blocks.

Turn on "Full Compiler Logging" and post results in a beginner site for simple how to code help.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
 

Tim S.
C Programmer working to learn more about C++.
Compiling CB Trunk against wxWidgets WX_3_0_BRANCH branch.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org/index.php?title=Main_Page