问题描述
我已将VS2017配置为通过在Linux Mint VM上进行远程构建来构建Linux C ++.我尝试了一个简单的C ++程序,它可以编译并很好地执行,事情是,现在我需要添加一个生成的protobuf源,并且链接不断失败.
I have configured VS2017 to build Linux C++ by remote building on a Linux Mint VM.I tried a simple C++ program and it compiles and executes fine, the thing is that now I need to add a generated protobuf source and the linking fails constantly.
在Linux VM上,protobuf生成的文件正在正确构建,并且我能够执行gRPC示例.
On the Linux VM the protobuf generated files are building correctly and I was able to execute the gRPC examples.
从VS2017构建时遇到的错误很多:
The errors I get when I build from VS2017 are a lot of:
对'google :: protobuf :: internal'
还有一个
C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ IDE \ VC \ VCTargets \ Application Type \ Linux \ 1.0 \ Linux.targets(262,5):错误:非法路径中的字符.
我认为这是VS2017远程编译配置问题,但我不知道这可能是什么.
I think this is a VS2017 remote compilation configuration issue, but I don't know what could it be.
这件事发生在你身上吗?你知道如何解决这个问题吗?
Has it happened to you? Do you know how to solve this issue?
谢谢
解决方案::我的项目属性进入 Linker>所有选项>库依赖项,并添加: protobuf; pthread; grpc ++; grpc
SOLUTION: I the project properties go to Linker > All Options > Library dependencies and add: protobuf;pthread;grpc++;grpc
推荐答案
解释了路径中的非法字符"消息.
This explains the "Illegal characters in path" message.
protobuf
是否链接到Linux系统上的任何库?假设您不使用CMake,是否已将库及其路径添加到Visual Studio项目中- Library Dependencies
和 Additional Library Directories
.这可能有助于指定库.
Does protobuf
link to any libraries on the Linux system? Assuming you're not using CMake, have you added the libraries andtheir path(s) to the Visual Studio project - Library Dependencies
and Additional Library Directories
.This might help with specifying libraries.
这篇关于使用VS2017为Linux构建protobuf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!