g ++未知/tmp/cc21HhMd.o:在函数`main :: {lambda(编译错误

问题描述 投票:0回答:1

我尝试使用g ++(GCC)4.8.5 20150623(Red Hat 4.8.5-39)进行编译一些开源的简单服务器正在使用我成功编译的uvlib这是github仓库:

https://github.com/Matheus28/ws28

这是编译命令:

g++  echo.cpp -Wall -O0 -g -std=c++1y -I/home/vagrant/libuv/include -Isrc -L/home/vagrant/libuv/build -lssl -lcrypto -luv

但是它给了我编译错误:

/tmp/cc21HhMd.o: In function `main::{lambda(ws28::Client*, char const*, unsigned long, int)#4}::operator()(ws28::Client*, char const*, unsigned long, int) const':
/home/vagrant/ws28/echo.cpp:36: undefined reference to `ws28::Client::Send(char const*, unsigned long, unsigned char)'
/tmp/cc21HhMd.o: In function `main::{lambda(uv_timer_s*)#6}::operator()(uv_timer_s*) const':
/home/vagrant/ws28/echo.cpp:58: undefined reference to `ws28::Server::StopListening()'
/tmp/cc21HhMd.o: In function `main':
/home/vagrant/ws28/echo.cpp:16: undefined reference to `ws28::Server::Server(uv_loop_s*, ssl_ctx_st*)'
/home/vagrant/ws28/echo.cpp:64: undefined reference to `ws28::Server::Listen(int, bool)'
/home/vagrant/ws28/echo.cpp:69: undefined reference to `ws28::Server::~Server()'
/home/vagrant/ws28/echo.cpp:69: undefined reference to `ws28::Server::~Server()'
collect2: error: ld returned 1 exit status
make: *** [out] Error 1

我不明白的是,从他来自哪里来处理这个物体的路线是什么?

/tmp/cc21HhMd.o: In function `main::{lambda(ws28::Client*, char const*, unsigned long, int)#4}::operator()(ws28::Client*, char const*, unsigned long, int) const':

我尝试使用g ++(GCC)4.8.5进行编译20150623(Red Hat 4.8.5-39)一些使用uvlib的开源简单服务器,我成功编译了这是github仓库:https:// github.。 ..

c++ linux compiler-errors g++ c++14
1个回答
0
投票

回答您的外部问题:您仍然需要针对链接的GitHub存储库中.cpp中的src文件进行编译和链接。您没有告诉我们您的构建系统是什么,但是我建议将ws28 src文件链接到静态库中并进行链接。然后,您可以通过链接到静态库来编译echo.cpp

© www.soinside.com 2019 - 2024. All rights reserved.