We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <iostream> #include <thread> #include "co/all.h" //#include "co/http.h" //#include "co/flag.h" //DEF_uint32(http_max_body_size, 40 << 20, "#2 max size of http body, default: 8M"); void cb(const http::Req& req, http::Res& res) { if (req.is_method_get()) { if (req.url() == "/hello") { res.set_status(200); res.set_body("hello world"); std::cout<<"============"<<std::endl; const char* data = req.body(); std::cout<<req.body()<<std::endl; } else { res.set_status(404); } } else { res.set_status(405); // method not allowed } } void test_http(){ http::Server().on_req(cb).start("0.0.0.0", 80); } int main(int argc, char** argv) { std::cout << "hello world!" << std::endl; FLG_http_max_body_size =40<<20; std::thread t1(test_http); while(1){} return 0; }
以上代码报错:
❗ error: main.cpp src\main.cpp(36): error C2065: “FLG_http_max_body_size”: 未声明的标识符
#include <iostream> #include <thread> #include "co/all.h" //#include "co/http.h" //#include "co/flag.h" DEF_uint32(http_max_body_size, 40 << 20, "#2 max size of http body, default: 8M"); void cb(const http::Req& req, http::Res& res) { if (req.is_method_get()) { if (req.url() == "/hello") { res.set_status(200); res.set_body("hello world"); std::cout<<"============"<<std::endl; const char* data = req.body(); std::cout<<req.body()<<std::endl; } else { res.set_status(404); } } else { res.set_status(405); // method not allowed } } void test_http(){ http::Server().on_req(cb).start("0.0.0.0", 80); } int main(int argc, char** argv) { std::cout << "hello world!" << std::endl; FLG_http_max_body_size =40<<20; std::thread t1(test_http); while(1){} return 0; }
加上定义也报错 error: co.lib(http.cc.obj) : error LNK2005: "unsigned int FLG_http_max_body_size" (?FLG_http_max_body_size@@3ia) 已经在 main.cpp.obj 中定义 build\windows\x64\debug\coost.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
The text was updated successfully, but these errors were encountered:
这个值在库里已经定义过,你应该声明(DEC)而不是定义(DEF)它
Sorry, something went wrong.
请问下这种我发送图片的这种,该怎么传送,接收
你这是另外一个问题了吧,我不懂,建议你新开一个issue
No branches or pull requests
以上代码报错:
❗ error: main.cpp
src\main.cpp(36): error C2065: “FLG_http_max_body_size”: 未声明的标识符
加上定义也报错
error: co.lib(http.cc.obj) : error LNK2005: "unsigned int FLG_http_max_body_size" (?FLG_http_max_body_size@@3ia) 已经在 main.cpp.obj 中定义
build\windows\x64\debug\coost.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
The text was updated successfully, but these errors were encountered: