Building protobuf for Linux using VS2017

我的梦境 提交于 2019-12-24 10:34:54

问题


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.

On the Linux VM the protobuf generated files are building correctly and I was able to execute the gRPC examples.

The errors I get when I build from VS2017 are a lot of:

undefined reference to 'google::protobuf::internal'

and there is also this one

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\Linux.targets(262,5): error : Illegal characters in path.

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?

Thanks

SOLUTION: I the project properties go to Linker > All Options > Library dependencies and add: protobuf;pthread;grpc++;grpc


回答1:


This explains the "Illegal characters in path" message.

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.



来源:https://stackoverflow.com/questions/49536952/building-protobuf-for-linux-using-vs2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!