尝试在Windows上构建mysql-connector-cpp [英] Trying to build mysql-connector-cpp on Windows

查看:120
本文介绍了尝试在Windows上构建mysql-connector-cpp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够以调试模式(VS2k17)构建mysql-connector/c ++应用程序,并且了解我能做到的唯一方法是首先从计算机上的源代码构建mysql-connector-cpp(Windows 10/64位) .我尝试了以下方法:

I want to be able to build mysql-connector/c++ applications in debug mode (VS2k17), and understand the only way I can do that is to first build mysql-connector-cpp from source on my computer (Windows 10/64bit). I tried the following:

cmake . -DWITH_SSL=C:\Users\Rawb\source\libraries\OpenSSL-Win64

它看起来可以成功完成...

and it looks to complete successfully ...

Install location: C:/Users/Rawb/MySQL/MySQL Connector C++ 8.0
Connector libraries will be installed at: lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Rawb/source/repos/mcc2/mysql-connector-cpp

但是当我运行以下cmake构建时...

but when I run the following cmake build ...

cmake --build . --config

此输出失败...

LINK : fatal error LNK1104: cannot open file 'ssleay32.lib' [C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj]
Done Building Project "C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\ALL_BUILD.vcxproj" (default targets) -- FAILED.
Build FAILED.

"C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj" (default target) (10) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ssleay32.lib' [C:\Users\Rawb\source\repos\mcc2\mysql-connector-cpp\connector.vcxproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:14.57

我可能做错了什么?我是否只需要将ssleay32.lib文件放置在某个地方?我确实有它的副本,但不确定应如何包含它.还是更复杂? IE.我还需要先在计算机上构建Open SSL吗?对我来说这是一个深兔子洞,我可能在头顶上哈哈!

What might I be doing wrong? Do I just need to place the ssleay32.lib file somewhere? I do have a copy of it but not sure how it should be included. Or is it more complex? I.e. Do I need to build Open SSL first on my machine as well? This is a deep rabbit hole for me, I may be in over my head haha!

注意:我也曾在Reddit上问过这个问题,但是没有运气,所以希望这里的人可能知道.

NOTE: I also asked this question on reddit with no luck, so hoping someone here might know.

推荐答案

  1. 如果您使用的是MSVS(任何版本,包括MSVS 2017),那么我建议您使用"NMake"(而不是cmake).或者只是在MSVS IDE中创建一个新的C/C ++库项目.

  1. If you're using MSVS (any version, including MSVS 2017), then I'd suggest using "NMake" (instead of cmake). Or just create a new C/C++ library project in the MSVS IDE.

您要查找的标志是/LIBPATH.我认为您不需要"-D",但是您肯定地需要"/LIBPATH".

The flag you're looking for is /LIBPATH. I don't think you need "-D", but you certainly need "/LIBPATH".

以下是MSVS链接器选项:

Here are the MSVS linker options:

https://docs .microsoft.com/en-us/cpp/build/reference/linker-options?view = vs-2017

最后,您可以进行所有想要的故障排除/跟踪,而无需 实际调试(和重建)连接器代码.

Finally, you might be able to do all the troubleshooting/tracing you want without actually debugging (and rebuilding) the connector code.

以下是在MySQL连接器中启用跟踪的方法:

Here's how to enable tracing in the MySQL Connector:

https://dev .mysql.com/doc/connector-cpp/1.1/en/connector-cpp-debug-tracing.html

请告诉我这是否有帮助.

Please let me know if this helps.

这篇关于尝试在Windows上构建mysql-connector-cpp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆