R
Rob
I think this is kind of a mish mash of understanding problems.
I have never needed to include an outside library before, and I am just
failing at every turn (Please keep in mind that I have never been taught C
I have only read books).
You might be able to help me without knowing my tools so please read on,
but here is my setup : Linux (2.4.20), the Anjuta IDE,
(anjuta.sourceforge.net) and the library I am trying to use is Scinitlla
(www.scintilla.org).
I think I can figure it out if I can just understand a couple things.
1) I have compiled the library and there are several object files and an
..a(?) file. In anjuta I have to specify a "library path" and a "library" -
this in turn is passed to ld (I think). Is the library path to the .o
files or .a file? and is the name of the library the .a file? (at least I
understand the include path )
2) The library is written in C++, but I am using C for my program. There
is a setting in Anjuta to "use both C and C++" in the project - does that
appear to be in effect? (gcc not g++)?
At present I have the library path set to point to the .a file. When I
make this is where errors happen:
[key]
(/home/rob/Projects/scintilla/bin/ = the .a file - scintilla.a)
(/home/rob/Projects/scintilla/include/ = the .h files)
(/home/rob/Projects/scintilla/gtk/ = .o files)
[/key]
-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
make[2]: Entering directory `/home/rob/Projects/bregalad/src' /bin/sh
.../libtool --mode=link gcc -g -O2 -o bregalad
-L/home/rob/Projects/scintilla/bin/ bregalad-main.o -Wl ,--export-dynamic
-lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0
-lpangox-1.0 -lpango -1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
-lgthread
gcc -g -O2 -o bregalad bregalad-main.o -Wl,--export-dynamic
-L/home/rob/Projects/scintilla/bin/ -lgtk-x11-2.0 - latk-1.0 -lgdk-x11-2.0
-lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0
-lgmodule-2.0 -ldl -lglib-2.0 /usr/lib/libgthread.so -lpthread
[boom - it can't find the library?]
bregalad-main.o(.text+0x3f): In function `main':
/home/rob/Projects/bregalad/src/main.c:20: undefined reference to
`scintilla_new'
bregalad-main.o(.text+0x46):/home/rob/Projects/bregalad/src/main.c:21:
undefined reference to `scintilla_get_typ e'
bregalad-main.o(.text+0xa7):/home/rob/Projects/bregalad/src/main.c:27:
undefined reference to `scintilla_set_id'
....[snip]...
bregalad-main.o(.text+0x123):/home/rob/Projects/bregalad/src/main.c:54:
more undefined references to `scintilla_ send_message' follow
collect2: ld returned 1 exit status
Again sorry for my lack of knowledge I have written many program, and
never needed to do anything like this before. Times like these I remember
how little I actaully know.
Thanks in advance (and Cheers to UKers),
Rob
I have never needed to include an outside library before, and I am just
failing at every turn (Please keep in mind that I have never been taught C
I have only read books).
You might be able to help me without knowing my tools so please read on,
but here is my setup : Linux (2.4.20), the Anjuta IDE,
(anjuta.sourceforge.net) and the library I am trying to use is Scinitlla
(www.scintilla.org).
I think I can figure it out if I can just understand a couple things.
1) I have compiled the library and there are several object files and an
..a(?) file. In anjuta I have to specify a "library path" and a "library" -
this in turn is passed to ld (I think). Is the library path to the .o
files or .a file? and is the name of the library the .a file? (at least I
understand the include path )
2) The library is written in C++, but I am using C for my program. There
is a setting in Anjuta to "use both C and C++" in the project - does that
appear to be in effect? (gcc not g++)?
At present I have the library path set to point to the .a file. When I
make this is where errors happen:
[key]
(/home/rob/Projects/scintilla/bin/ = the .a file - scintilla.a)
(/home/rob/Projects/scintilla/include/ = the .h files)
(/home/rob/Projects/scintilla/gtk/ = .o files)
[/key]
-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
make[2]: Entering directory `/home/rob/Projects/bregalad/src' /bin/sh
.../libtool --mode=link gcc -g -O2 -o bregalad
-L/home/rob/Projects/scintilla/bin/ bregalad-main.o -Wl ,--export-dynamic
-lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0
-lpangox-1.0 -lpango -1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
-lgthread
gcc -g -O2 -o bregalad bregalad-main.o -Wl,--export-dynamic
-L/home/rob/Projects/scintilla/bin/ -lgtk-x11-2.0 - latk-1.0 -lgdk-x11-2.0
-lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0
-lgmodule-2.0 -ldl -lglib-2.0 /usr/lib/libgthread.so -lpthread
[boom - it can't find the library?]
bregalad-main.o(.text+0x3f): In function `main':
/home/rob/Projects/bregalad/src/main.c:20: undefined reference to
`scintilla_new'
bregalad-main.o(.text+0x46):/home/rob/Projects/bregalad/src/main.c:21:
undefined reference to `scintilla_get_typ e'
bregalad-main.o(.text+0xa7):/home/rob/Projects/bregalad/src/main.c:27:
undefined reference to `scintilla_set_id'
....[snip]...
bregalad-main.o(.text+0x123):/home/rob/Projects/bregalad/src/main.c:54:
more undefined references to `scintilla_ send_message' follow
collect2: ld returned 1 exit status
Again sorry for my lack of knowledge I have written many program, and
never needed to do anything like this before. Times like these I remember
how little I actaully know.
Thanks in advance (and Cheers to UKers),
Rob