Closed Tracker647 closed 1 year ago
刘德聪,已经收到你的邮件,请你放心 祝你生活愉快,笑口常开
问题解决,是库声明顺序的问题,muduo_net库需要用到muduo_base的组件 g++ -g -o BufferTest BufferTest.cpp -lmuduo_net -lmuduo_base -lpthread 得改成 g++ -g -o BufferTest BufferTest.cpp -lmuduo_base -lmuduo_net -lpthread
还是基础不行= =
在测试muduo/net/http/tests下的测试代码时发现HttpServer_test能正常运行,但是HttpRequest_unittest下一直提示Buffer的findCRLF方法undefined,去除boost库后仍旧报这个错误,后面又把这个类单独提出来测试:
测试代码: `
include <muduo/net/Buffer.h>
include <muduo/base/Logging.h>
using muduo::string; using muduo::net::Buffer; using muduo::Logger;
int main(){ Buffer input; input.append("GET /index.html HTTP/1.1\r\n" "Host: www.chenshuo.com\r\n" "User-Agent:\r\n" "Accept-Encoding: \r\n" "\r\n"); input.findCRLF(); input.findEOL(); } ` 输出结果:![image](https://user-images.githubusercontent.com/54085641/209442858-95e79477-6e01-4254-9dc9-71c3a907eb96.png)
把muduo::net::sockets::下定义的所有函数都报错了一遍,不知道和Buffer有什么关系 根据输出结果把base/logging和net/SocketOps.h头文件都引入了进来,仍旧爆同样错误
我之前根据https://www.cnblogs.com/conefirst/articles/15224039.html将muduo的头文件和链接库lmuduo_base lmuduo_net lmuduo_http等分别移动到/usr/local/include和/usr/local/lib上 不知道是链接库的问题还是我忽略了哪里。
Linux distro and version? x86 or ARM? 32-bit or 64-bit?
Linux 5.4.0-108-generic #122-Ubuntu SMP x86_64 GNU/Linux 64bit
Branch (cpp98/cpp11/cpp17) and version of muduo?
cpp11
Version of cmake, gcc and boost? (If not from distro.)
gcc 9.4.0 cmake version 3.16.3