当前位置: 技术问答>linux和unix
在linux下怎样调用.so库文件??? 麻烦大侠指教!!!
来源: 互联网 发布时间:2015-09-27
本文导语: 我首先编译了一个slib.so库文件,然后怎么样在makefile里面设置才能调用这个库文件的函数啊,请高手给小弟一些详细的指教。makefile文件是用qmake生成的。makefile文件的内容如下: ##################################################...
我首先编译了一个slib.so库文件,然后怎么样在makefile里面设置才能调用这个库文件的函数啊,请高手给小弟一些详细的指教。makefile文件是用qmake生成的。makefile文件的内容如下:
#############################################################################
# Makefile for building: tutorial3
# Generated by qmake (1.05a) (Qt 3.1.2) on: Thu May 12 10:36:24 2005
# Project: tutorial3.pro
# Template: app
# Command: $(QMAKE) -o Makefile tutorial3.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -g -pipe -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I$(QTDIR)/mkspecs/default -I. -I. -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS =
SOURCES = 3.cpp
OBJECTS = 3.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = tutorial3.pro
QMAKE_TARGET = tutorial3
DESTDIR =
TARGET = tutorial3
first: all
####### Implicit rules
.SUFFIXES: .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $
#############################################################################
# Makefile for building: tutorial3
# Generated by qmake (1.05a) (Qt 3.1.2) on: Thu May 12 10:36:24 2005
# Project: tutorial3.pro
# Template: app
# Command: $(QMAKE) -o Makefile tutorial3.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -g -pipe -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I$(QTDIR)/mkspecs/default -I. -I. -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS =
SOURCES = 3.cpp
OBJECTS = 3.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = tutorial3.pro
QMAKE_TARGET = tutorial3
DESTDIR =
TARGET = tutorial3
first: all
####### Implicit rules
.SUFFIXES: .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $