zoukankan      html  css  js  c++  java
  • linux 创建动态库

    参考 http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
    gcc -fPIC -g -c -Wall a.c
    gcc -fPIC -g -c -Wall b.c
    gcc -shared -Wl,-soname,libmystuff.so.1 \
        -o libmystuff.so.1.0.1 a.o b.o –lc

    makefile

    CC            = gcc
    CXX           = g++
    DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
    CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
    INCPATH       = -I../../../../x86/mkspecs/qws/linux-x86-g++ -I. -I../../../../x86/include/QtCore -I../../../../x86/include/QtNetwork
    -I../../../../x86/include/QtGui -I../../../../x86/include -I. -I.
    LINK          = g++
    LFLAGS        = -Wl,-O1 -Wl,-rpath,/opt/qt-everywhere/x86/lib -shared -Wl,-soname,libclient.so.1
    LIBS          = $(SUBLIBS)  -L/opt/qt-everywhere/x86/lib -lQtGui -L/opt/qt-everywhere/x86/lib -lQtNetwork -lQtCore –lpthread

    ####### Implicit rules

    .SUFFIXES: .o .c .cpp .cc .cxx .C

    .cpp.o:
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .cc.o:
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .cxx.o:
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .C.o:
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

    .c.o:
        $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"

    $(TARGET):  $(OBJECTS)

        -$(DEL_FILE) $(TARGET)

        $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)

  • 相关阅读:
    Mockito
    输入一个链表,输出该链表中倒数第k个结点。
    序列化
    全排列
    PostgreSQL libpq学习指南二
    PostgreSQL libpq 客户端接口(一)
    PostgreSQL 中的shared buffer
    通过 Unwrapper 解密 DBMS 程序包
    openGuassDB介绍及安装实践
    PostgreSQL中的ACID特性介绍
  • 原文地址:https://www.cnblogs.com/cute/p/1964046.html
Copyright © 2011-2022 走看看