08-30-2010
Compiling and linking Shared Libraries.
here is the output:
$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)
$ file libCommon.so
libCommon.so: ASCII text, with no line terminators
I found that .so file is ascii its contents are:
$ cat libCommon.so
libCommon.so.1.0.0
now i tried following:
$ gcc My_program.c libCommon.so.1.0.0
My_program.c: In function āmainā:
My_program.c:13: warning: parameter names (without types) in function declaration
libCommon.so.1.0.0: undefined reference to `dlsym'
libCommon.so.1.0.0: undefined reference to `dlopen'
libCommon.so.1.0.0: undefined reference to `dlclose'
collect2: ld returned 1 exit status
$ gcc My_program.c -llibCommon.so.1.0.0
My_program.c: In function āmainā:
My_program.c:13: warning: parameter names (without types) in function declaration
/usr/bin/ld: cannot find -llibCommon.so.1.0.0
collect2: ld returned 1 exit status
$ gcc My_program.c -l libCommon.so.1.0.0
My_program.c: In function āmainā:
My_program.c:13: warning: parameter names (without types) in function declaration
/usr/bin/ld: cannot find -llibCommon.so.1.0.0
collect2: ld returned 1 exit status
$ gcc My_program.c -lCommon.so.1.0.0
My_program.c: In function āmainā:
My_program.c:13: warning: parameter names (without types) in function declaration
/usr/bin/ld: cannot find -lCommon.so.1.0.0
collect2: ld returned 1 exit status
Thanks in advance
10 More Discussions You Might Find Interesting
1. Programming
Hi mates,
I am trying to copile and link to C programs with command:
cc file1,file2
but i raises the error "file not found" ... am i doing the right way?
any suggestion will be appreciated.
thanks
abdul (4 Replies)
Discussion started by: abdul
4 Replies
2. Programming
I'm runtime linking (dlopen and dlsym) to a shared object (library) I've created and after a number of function calls into the library the program core dumps (Illegal operation). This only occurs during runtime linking. If I use the same library and dynamically link during compile time everything... (3 Replies)
Discussion started by: dneely
3 Replies
3. Programming
Hello everybody,
I am having major problems at the moment with shared libraries and I have to little knowledge of them to solve them. So please, please help me :)
Ok this is the problem:
I have a library A, which uses B and C, and C uses again D.
If I try to run A as plugin in apache,... (0 Replies)
Discussion started by: Micky
0 Replies
4. Programming
I am compiling code which produces .a and .la libraries. How can I produce .so libraries? I know that gcc -shared does but how? (2 Replies)
Discussion started by: thalex
2 Replies
5. Programming
Hi
I'm getting
ld: fatal: option -h and building a dynamic executable are incompatible
ld: fatal: Flags processing errors
When I run
ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o
after running
gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c
I'm... (6 Replies)
Discussion started by: laho
6 Replies
6. Programming
I'm trying to do something fairly simple but keep getting frustrating messages..
Here it is:
I have 3 files:
init.h <header>
init.c <#include <curses.h> and "init.h">
main.c <#include "init.h">
now, how can I compile my main.c using gcc?
( I have a hard time making the init.o)
... (1 Reply)
Discussion started by: My_Name
1 Replies
7. Programming
hi all !
Do I need all the shared objects to be present while compiling my code which has reference to a only one shared object, which in turn refers to another shared object.
for example I want to compile example.c which refers to sample.so
sample.so has refrence to anothersample.so
do... (2 Replies)
Discussion started by: disclaimer
2 Replies
8. Linux
How do i make a library shared
say i have a library a.so which i have just compiled.
I want to make it shared how do i make it
Next Queation is what is the difference between a.so.0 a.so.1 a.so.2 & a.so :rolleyes: (1 Reply)
Discussion started by: wojtyla
1 Replies
9. OS X (Apple)
I'm trying to get Valgrind to work with an openmpi application in OS X. However I want to hardcode the path to a shared library called libmpiwrap-amd64-darwin.so into my application so that it is available at runtime. In Linux this is relatively simple, I would just add the option... (0 Replies)
Discussion started by: Valgrinder
0 Replies
10. SuSE
Hi everyone I installed OpenSuse 12.3 and many development tools but when i propose build the kernel from the source (the first step make menuconfig) i saw this:
HOSTLD scripts/kconfig/mconf
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdl.so.2,... (2 Replies)
Discussion started by: bacesado
2 Replies
LEARN ABOUT DEBIAN
fltk-config
fltk-config(1) General Commands Manual fltk-config(1)
NAME
fltk-config - script to get information about the installed version of fltk.
SYNOPSIS
fltk-config [ --prefix [=DIR] ] [ --exec-prefix [=DIR] ] [ --version ] [ --api-version ] [ --use-gl ] [ --use-images ] [ --use-glut ] [
--cc ] [ --cxx ] [ --cflags ] [ --cxxflags ] [ --ldflags ] [ --ldstaticflags ] [ --libs ] [ -Dname[=value] ] [ -g ] [ --compile program.cxx
]
DESCRIPTION
fltk-config is a utility script that can be used to get information about the current version of FLTK that is installed on the system, what
compiler and linker options to use when building FLTK-based applications, and to build simple FLTK applications.
The following options are supported:
--api-version
Displays the current FLTK API version number, e.g. "1.1".
--cc
--cxx
Displays the C/C++ compiler that was used to compile FLTK.
--cflags
--cxxflags
Displays the C/C++ compiler options to use when compiling source files that use FLTK.
--compile program.cxx
Compiles the source file program.cxx into program. This option implies "--post program".
-g
Enables debugging information when compiling with the --compile option.
--ldflags
Displays the linker options to use when linking a FLTK application.
--ldstaticflags
Displays the linker options to use when linking a FLTK application to the static FLTK libraries.
--libs
Displays the full path to the FLTK library files, to be used for dependency checking.
--use-gl
Enables OpenGL support.
--use-glut
Enables GLUT support.
--use-images
Enables image file support.
--version
Displays the current FLTK version number, e.g. "1.1.0".
SEE ALSO
fluid(1), fltk(3)
FLTK Programming Manual
FLTK Web Site, http://www.fltk.org/
AUTHORS
Bill Spitzak and others.
6 February 2007 Fast Light Tool Kit fltk-config(1)