2

I'm tring to compile the bait example from the Scintilla website. I have had ZERO luck in getting it to compile. I can compile scintilla itself just fine, as well as scite but bait is a different story. When I try and compile with the supplied Makefile, I get the following error:

bait.c:1:21: fatal error: gtk/gtk.h: No such file or directory

I have GTK, and using different versions of it.I've tried It doesn't seem to matter what I do. I've scowered the Internet for help, read through man page after man page and I just can't figure out what the problem is. If I don't get that error, then I just get another one.

Here's the original makefile:

.SUFFIXES: .c .o .h .a

INCLUDEDIRS=-I../scintilla/include
CXXFLAGS= -DGTK -DSCI_LEXER -W -Wall
LEXEROBJS=$(wildcard ../scintilla/gtk/Lex*.o)

all: bait

shiz:
gcc `pkg-config --cflags gtk+-2.0` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@
bait: bait.o $(LEXEROBJS) ../scintilla/bin/scintilla.a
gcc `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK $^ -o $@
clean:
rm -rf bait *.o

I've also tried using GtkScintilla from codebrainz. I can't even make that work. I always get either the above error, or an error saying:

fatal error: gtk/gtk.h: No such file or directory

I'd really appreciate any and all help on this. Thank you.

Edit: I'm using Linux Mint

9
  • where is gtk.h located in your system? (ie. result of find . -name "gtk.h")
    – Mike
    Sep 14, 2012 at 18:17
  • That returns nothing at all... which is very odd.
    – Sarah
    Sep 14, 2012 at 18:21
  • Which means you lack the proper header file. Are you certain you installed the library correctly? Sep 14, 2012 at 18:26
  • I know that I have GTK. I can compile GTK programs. I don't know what changes here. Also, I don't know if the find command is even working properly, as I can't get it to return anything.
    – Sarah
    Sep 14, 2012 at 18:27
  • That error is gone now... and I have got it to make an object file, but there are a lot of undefined reference problems now... lots and lots. I'd post them, if that'd be helpful.
    – Sarah
    Sep 14, 2012 at 18:41

2 Answers 2

1

Coming back to this... If you've already solved the issue please let me know. What it's starting to look like is this is more trouble than it's worth. :)

here's what I did:

  1. Install Mint 13 on my virtual box
  2. libgtk-3-dev (and supporting packages)
  3. verify I could build with pkg-config --cflags --libs gtk+-3.0
  4. found gtk.h (/usr/include/gtk-3.0/gtk/gtk.h) and supporting files
  5. downloaded bait example

Here's the problems:

  1. bait's Makefile has references to gtk+-2.0 which you need to change to 3.0
  2. bait's Makefile requires you to build in a specific directory (note the INCLUDEDIRS needs you to be in the scintilla directory
  3. archive scintilla.a needs to be built (it's not provided and is required for bait.o)
  4. building the archive needs you to modify the makefile (comment out these lines:

    ifdef GTK3 else GTKVERSION=gtk+-2.0 endif

  5. Once you fix that and build the archive there's about a million more undefined references in: ScintillaGTK.cxx:(.text+0x1374) and the like..

Anyway. I'll give it a little more time, let me know if you close this issue yourself!

1
  • I thought that might work, but I have already tried that and I have exactly the same result, I'm afraid. I appreciate the attempt, in any case. This is a confusing one. :/
    – Sarah
    Sep 14, 2012 at 19:13
-1

i've done with this makefile

##### Makefile #####
# Make file for bait on Linux or compatible OS
# Released to the public domain 2000 by Neil Hodgson [email protected]
# This makefile tested with GCC 3.2 and GNOME 2.0

.SUFFIXES: .c .o .h .a

ifdef GTK3
GTKVERSION=gtk+-3.0
else
GTKVERSION=gtk+-2.0
endif

INCLUDEDIRS=-I../scintilla/include
CXXFLAGS= -DGTK -DSCI_LEXER -W -Wall
LEXEROBJS=$(wildcard ../scintilla/gtk/Lex*.o)

all: bait

.c.o:
    gcc `pkg-config --cflags $(GTKVERSION)` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@
bait: bait.o $(LEXEROBJS) ../scintilla/bin/scintilla.a
    gcc -DGTK $^ -o $@ -lstdc++ `pkg-config --libs $(GTKVERSION) gthread-2.0` -lm -lgmodule-2.0
clean:
    rm -rf bait *.o

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.