Skip to content
New issue

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

HttpRequest 的警告 #669

Open
hmuyin opened this issue Jan 9, 2025 · 2 comments
Open

HttpRequest 的警告 #669

hmuyin opened this issue Jan 9, 2025 · 2 comments

Comments

@hmuyin
Copy link

hmuyin commented Jan 9, 2025

解决方案:AAA
工程 base:静态库,基础公共函数
工程 main:应用程序,主程序,会调用 base 中的一些函数

其中 base 中重新封装了 wget (hv_wget_win.h,hv_wget_win.cpp )
hv_wget_win.cpp:
#include <hv/requests.h>
int Wget(const string& url, const string& savePath, wget_progress_cb cb, string* message, bool use_range)
{
HttpRequest req;
return 0;
}

在main工程中调用
main.cpp
#include <hv/requests.h>
#include "../base/hv_wget_win.h"
int main(){
Wget(....);
在main中后续也要使用 HttpRequest req;
}

导致编译报以下警告:

LINK : warning LNK4217: 符号“??0HttpRequest@@qeaa@XZ (public: __cdecl HttpRequest::HttpRequest(void))”(在“ hv_static.lib(HttpMessage.cpp.obj)”中定义)已由“Base.lib(hv_wget_win.obj)”(函数“"int __cdecl Wget(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::function<void __cdecl(unsigned __int64,unsigned __int64)>,class std::basic_string<char,struct std::char_traits,class std::allocator > *,bool)" (?Wget@@YAHAEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@0V?$function@$$A6AX_K0@Z@2@PEAV12@_N@Z)”中)导入

当然他不影响实际结果,但是我不希望他出现这种警告。
这个应该怎么解决

@ithewei
Copy link
Owner

ithewei commented Jan 10, 2025

windows下使用hv静态库,你的工程里需要加预定义HV_STATICLIB

@hmuyin
Copy link
Author

hmuyin commented Jan 10, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants