vs使用vcpkg

时间:2024-03-24 17:02:25

要用vs2017编译七牛云c sdk,安装好vcpkg后,怎么都找不到文件,然后在知乎上看到要重启一下,接着重启,很多问题就解决了
vs2017使用vcpkg
参考:https://www.zhihu.com/question/263416411/answers/updated

最后在一堆错误下,编译通过

====================[ Build | qiniu | Release-Visual Studio ]===================
C:\Users\pikachu\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\191.5701.24\bin\cmake\win\bin\cmake.exe --build C:\Users\pikachu\Documents\c-sdk\build --target qiniu --
Scanning dependencies of target qiniu
[  5%] Building C object CMakeFiles/qiniu.dir/b64/b64.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
b64.c
[ 10%] Building C object CMakeFiles/qiniu.dir/b64/urlsafe_b64.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
urlsafe_b64.c
[ 15%] Building C object CMakeFiles/qiniu.dir/cJSON/cJSON.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
cJSON.c
[ 21%] Building C object CMakeFiles/qiniu.dir/qiniu/auth_mac.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
auth_mac.c
[ 26%] Building C object CMakeFiles/qiniu.dir/qiniu/base.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
base.c
C:\Users\pikachu\Documents\c-sdk\qiniu\base.c(235): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(536): note: 参见“strdup”的声明
C:\Users\pikachu\Documents\c-sdk\qiniu\base.c(269): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(536): note: 参见“strdup”的声明
[ 31%] Building C object CMakeFiles/qiniu.dir/qiniu/base_io.c.obj
base_io.c
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
[ 36%] Building C object CMakeFiles/qiniu.dir/qiniu/cdn.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cdn.c
cl: 命令行 warning D9002 :忽略未知选项“-g”
C:\Users\pikachu\Documents\c-sdk\qiniu\cdn.c(18): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: 参见“sprintf”的声明
C:\Users\pikachu\Documents\c-sdk\qiniu\cdn.c(210): warning C4028: 形参 4 与声明不同
[ 42%] Building C object CMakeFiles/qiniu.dir/qiniu/conf.c.obj
conf.c
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
C:\Users\pikachu\Documents\c-sdk\qiniu\conf.c: warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
[ 47%] Building C object CMakeFiles/qiniu.dir/qiniu/emu_posix.c.obj
emu_posix.c
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
[ 52%] Building C object CMakeFiles/qiniu.dir/qiniu/fop.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
fop.c
cl: 命令行 warning D9002 :忽略未知选项“-g”
[ 57%] Building C object CMakeFiles/qiniu.dir/qiniu/http.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
http.c
C:\Users\pikachu\Documents\c-sdk\qiniu\http.c(226): warning C4244: “return”: 从“Qiniu_Int64”转换到“int”,可能丢失数据
C:\Users\pikachu\Documents\c-sdk\qiniu\http.c(232): warning C4244: “=”: 从“Qiniu_Int64”转换到“int”,可能丢失数据
C:\Users\pikachu\Documents\c-sdk\qiniu\http.c(378): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1961): note: 参见“_snprintf”的声明
[ 63%] Building C object CMakeFiles/qiniu.dir/qiniu/io.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
io.c
C:\Users\pikachu\Documents\c-sdk\qiniu\io.c(160): warning C4244: “=”: 从“Qiniu_Off_T”转换到“size_t”,可能丢失数据
[ 68%] Building C object CMakeFiles/qiniu.dir/qiniu/qetag.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
qetag.c
c:\users\pikachu\documents\c-sdk\qiniu\qetag.h: warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
[ 73%] Building C object CMakeFiles/qiniu.dir/qiniu/reader.c.obj
reader.c
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
[ 78%] Building C object CMakeFiles/qiniu.dir/qiniu/resumable_io.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
resumable_io.c
cl: 命令行 warning D9002 :忽略未知选项“-g”
[ 84%] Building C object CMakeFiles/qiniu.dir/qiniu/rs.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
rs.c
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(71): warning C4244: “函数”: 从“Qiniu_Uint64”转换到“double”,可能丢失数据
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(74): warning C4244: “函数”: 从“Qiniu_Uint64”转换到“double”,可能丢失数据
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(96): warning C4244: “函数”: 从“time_t”转换到“double”,可能丢失数据
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(122): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: 参见“sprintf”的声明
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(319): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: 参见“sprintf”的声明
C:\Users\pikachu\Documents\c-sdk\qiniu\rs.c(342): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(536): note: 参见“strdup”的声明
[ 89%] Building C object CMakeFiles/qiniu.dir/qiniu/rsf.c.obj
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
rsf.c
[ 94%] Building C object CMakeFiles/qiniu.dir/qiniu/tm.c.obj
tm.c
cl: 命令行 warning D9002 :忽略未知选项“-std=c99”
cl: 命令行 warning D9002 :忽略未知选项“-g”
C:\Users\pikachu\Documents\c-sdk\qiniu\tm.c(52): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1961): note: 参见“_snprintf”的声明
[100%] Linking C static library qiniu.lib
[100%] Built target qiniu

Build finished