使用makefile和附加静态库在Raspberry Pi上进行制作

时间:2019-06-14 16:28:06

标签: c++ makefile

我尝试在我的rasp上编译一些代码... 我使用来自https://github.com/jamiebullock/generic-makefile的makefile 我有一个静态的lib项目和一个exe或正在使用我的静态lib的文件。 我为两个项目使用了相同的makefile。但是我在我的可执行文件上出现链接错误?

我有无法解析的符号... 由于我想问的是编译不正确,我也必须在我的makefile中添加linux boost软件包吗?

静态库设置:

   # The name of the product to build (default uses parent directory name)
   NAME ?= $(notdir $(CURDIR))
   # The file suffix of source files, can be .c or .cpp
   SUFFIX ?= .cpp
   # List of directories containing source files to be compiled
   DIRS ?= ./src
   # Flags to pass to the compiler for release builds
   FLAGS ?= -O3 -D LINUX -D _DEBUG -D _CONSOLE
   # Flags to pass to the compiler for debug builds
   DEBUG_FLAGS ?= -O0 -g -D LINUX -D _DEBUG -D _CONSOLE
   # Flags to pass to the linker
   LDFLAGS ?= 
   # Type of product to build: "shared" for a shared library, "static" for a 
   static library, empty for standalone
   LIBRARY ?= static
   # Prefix to the path that the "install" target will install into. libs to 
   $(PREFIX)/lib, executables to $(PREFIX)/bin
   PREFIX ?= /home/source

可执行设置:

    # The name of the product to build (default uses parent directory name)
    NAME ?= $(notdir $(CURDIR))
    # The file suffix of source files, can be .c or .cpp
    SUFFIX ?= .cpp
    # List of directories containing source files to be compiled
    DIRS ?= /home/source/updateserver/src
    # Flags to pass to the compiler for release builds
    FLAGS ?= -O3 -D LINUX -D NDEBUG -D _CONSOLE
    # Flags to pass to the compiler for debug builds
    DEBUG_FLAGS ?= -O0 -g -D LINUX -D _DEBUG -D _CONSOLE
    # Flags to pass to the linker
    LDFLAGS ?= -pthread -W -Bstatic -L/home/source/dronecpp -dronecpp.a
    # Type of product to build: "shared" for a shared library, "static" for a 
    static library, empty for standalone
    LIBRARY ?= 
    # Prefix to the path that the "install" target will install into. libs to 
    $(PREFIX)/lib, executables to $(PREFIX)/bin
    PREFIX ?= /home/source

这就是我得到的: < [root @ Archlinux updateserver]#make / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::OnRun()': main.cpp:(.text._ZN5Shell5OnRunEv[_ZN5Shell5OnRunEv]+0x48): undefined reference to ServerBase :: SetEndpoint(char const *,int const&)'中 / usr / bin / ld:main.cpp :(。text._ZN5Shell5OnRunEv [_ZN5Shell5OnRunEv] + 0x50):对ServerBase::Initialize()' /usr/bin/ld: main.cpp:(.text._ZN5Shell5OnRunEv[_ZN5Shell5OnRunEv]+0x58): undefined reference to ServerBase :: Join()const的未定义引用 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::Shutdown()': main.cpp:(.text._ZN5Shell8ShutdownEv[_ZN5Shell8ShutdownEv]+0x4): undefined reference to ServerBase :: Terminate()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Server::OnConnect(Link*)': main.cpp:(.text._ZN6Server9OnConnectEP4Link[_ZN6Server9OnConnectEP4Link]+0x4c): undefined reference to ClientBase :: Initialize()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Server::~Server()': main.cpp:(.text._ZN6ServerD2Ev[_ZN6ServerD5Ev]+0x20): undefined reference to ServerBase ::〜ServerBase()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Server::~Server()': main.cpp:(.text._ZN6ServerD0Ev[_ZN6ServerD5Ev]+0x20): undefined reference to ServerBase ::〜ServerBase()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::Select(Link*, Header*, unsigned char const*)': main.cpp:(.text._ZN5Shell6SelectEP4LinkP6HeaderPKh[_ZN5Shell6SelectEP4LinkP6HeaderPKh]+0x124): undefined reference to中System :: WriteLink(Link *,Header const *)const' / usr / bin / ld:main.cpp :(。text._ZN5Shell6SelectEP4LinkP6HeaderPKh [_ZN5Shell6SelectEP4LinkP6HeaderPKh] + 0x144):对System::CompileLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN5Shell6SelectEP4LinkP6HeaderPKh[_ZN5Shell6SelectEP4LinkP6HeaderPKh]+0x150): undefined reference to System :: BackupLink(Link *,Header const *)const的未定义引用 / usr / bin / ld:main.cpp :(。text._ZN5Shell6SelectEP4LinkP6HeaderPKh [_ZN5Shell6SelectEP4LinkP6HeaderPKh] + 0x15c):对System::RestoreLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN5Shell6SelectEP4LinkP6HeaderPKh[_ZN5Shell6SelectEP4LinkP6HeaderPKh]+0x168): undefined reference to System :: CreateDirectoryLink(Link *,Header const *)const的未定义引用 / usr / bin / ld:main.cpp :(。text._ZN5Shell6SelectEP4LinkP6HeaderPKh [_ZN5Shell6SelectEP4LinkP6HeaderPKh] + 0x174):未定义对System::DeleteDirectoryLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN5Shell6SelectEP4LinkP6HeaderPKh[_ZN5Shell6SelectEP4LinkP6HeaderPKh]+0x180): undefined reference to System :: GetFilesLink(Link *,Header const *)const'的引用 / usr / bin / ld:main.cpp :(。text._ZN5Shell6SelectEP4LinkP6HeaderPKh [_ZN5Shell6SelectEP4LinkP6HeaderPKh] + 0x18c):未定义对System::RestartAILink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN5Shell6SelectEP4LinkP6HeaderPKh[_ZN5Shell6SelectEP4LinkP6HeaderPKh]+0x198): undefined reference to的引用System :: ShutdownAILink(Link *,Header const *)const' / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::~Shell()': main.cpp:(.text._ZN5ShellD2Ev[_ZN5ShellD5Ev]+0x7c): undefined reference to ServerBase ::〜ServerBase()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::~Shell()': main.cpp:(.text._ZN5ShellD0Ev[_ZN5ShellD5Ev]+0x7c): undefined reference to ServerBase ::〜ServerBase()中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在功能Client::~Client()': main.cpp:(.text._ZN6ClientD2Ev[_ZN6ClientD5Ev]+0x68): undefined reference to vtable for ClientBase中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在功能Client::~Client()': main.cpp:(.text._ZN6ClientD0Ev[_ZN6ClientD5Ev]+0x74): undefined reference to vtable for ClientBase中 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Client::OnReceive(char const*, int const&, int const&)': main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x2c): undefined reference to中Header :: Header(unsigned char const *,int const&,int const&)' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x34):未定义对Header::GetUsage() const' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x1e4): undefined reference to Header :: GetSource( )const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x1f8):未定义对Header::SetTarget(unsigned char const*, int const&)' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x214): undefined reference to Header :: SetSource( unsigned char const *,int const&)' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x22c):未定义对Header::Build(unsigned char*, int const&)' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x290): undefined reference to System :: RestoreLink(链接*,标题const *)const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x2a8):对System::WriteLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x2c0): undefined reference to System :: BackupLink(链接*,标题const *)const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x2d8):对System::CompileLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x2f0): undefined reference to System :: CreateDirectoryLink(链接*,标题const *)const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x308):未定义对System::DeleteDirectoryLink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x320): undefined reference to System :: GetFilesLink(链接*,标题const *)const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x338):未定义对System::RestartAILink(Link*, Header const*) const' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x350): undefined reference to System :: ShutdownAILink(链接*,标题const *)const' / usr / bin / ld:main.cpp :(。text。 ZN6Client9OnReceiveEPKcRKiS3 [ ZN6Client9OnReceiveEPKcRKiS3 ] + 0x394):未定义对Header::SourceLength' /usr/bin/ld: main.cpp:(.text._ZN6Client9OnReceiveEPKcRKiS3_[_ZN6Client9OnReceiveEPKcRKiS3_]+0x398): undefined reference to Header :: HeaderLength'的引用 / usr / bin / ld:.build // home / source / updateserver / src / main.o:在函数Shell::Shell()': main.cpp:(.text._ZN5ShellC2Ev[_ZN5ShellC5Ev]+0xcc): undefined reference to中的DirectoryInfo :: DirectoryInfo(std :: __ cxx11 :: basic_string,std :: allocator>)' / usr / bin / ld:main.cpp :(。text._ZN5ShellC2Ev [_ZN5ShellC5Ev] + 0x13c):对ServerBase::~ServerBase()' /usr/bin/ld: .build//home/source/updateserver/src/main.o: in function main'的未定义引用: main.cpp :(。text.startup + 0x30):对ShellBase::Run()' /usr/bin/ld: main.cpp:(.text.startup+0x80): undefined reference to ServerBase :: ~~ ServerBase()的未定义引用 / usr / bin / ld:main.cpp :(。text.startup + 0xf0):未定义对DirectoryInfo的ServerBase::~ServerBase()' /usr/bin/ld: main.cpp:(.text.startup+0x108): undefined reference to vtable的引用 / usr / bin / ld:.build // home / source / updateserver / src / main.o :(。data.rel.ro._ZTI6Client [_ZTI6Client] + 0x8):对ServerBase的typeinfo for ClientBase' /usr/bin/ld: .build//home/source/updateserver/src/main.o:(.data.rel.ro._ZTI6Server[_ZTI6Server]+0x8): undefined reference to typeinfo的未定义引用' / usr / bin / ld:.build // home / source / updateserver / src / main.o :(。data.rel.ro._ZTI5Shell [_ZTI5Shell] + 0x8):对typeinfo for ShellBase' /usr/bin/ld: .build//home/source/updateserver/src/main.o:(.data.rel.ro._ZTV6Client[_ZTV6Client]+0x8): undefined reference to ClientBase的未定义引用::初始化()' / usr / bin / ld:.build // home / source / updateserver / src / main.o :(。data.rel.ro._ZTV6Client [_ZTV6Client] + 0xc):对ClientBase::Terminate()' /usr/bin/ld: .build//home/source/updateserver/src/main.o:(.data.rel.ro._ZTV6Server[_ZTV6Server]+0x8): undefined reference to ServerBase的未定义引用::初始化()' / usr / bin / ld:.build // home / source / updateserver / src / main.o :(。data.rel.ro._ZTV6Server [_ZTV6Server] + 0xc):对ServerBase::Terminate()' /usr/bin/ld: .build//home/source/updateserver/src/main.o:(.data.rel.ro._ZTV5Shell[_ZTV5Shell]+0x10): undefined reference to ShellBase的未定义引用:: Push(std :: __ cxx11 :: basic_string,std :: allocator>,...)' collect2:错误:ld返回1退出状态 make:*** [makefile:85:updateserver]错误1 >

0 个答案:

没有答案