0

I am using visual studios 2019 and trying to compile the protobuf C++ example. I followed all the steps from the document(readme.txt) and built the .lib file and included it in the project and compiled it. It still shows these link issues and they don't seem to go away. Also i have tried using the newest version protobuf and the earlier (3.17, 3.16 ) thats is available If anyone can please help or guide me to resolve this issue.

\error LNK2019: unresolved external symbol "public: bool __cdecl google::protobuf::MessageLite::ParseFromArray(void const *,int)" (?ParseFromArray@MessageLite@protobuf@google@@QEAA_NPEBXH@Z) referenced in function "void __cdecl ReceiveRequest(bool *)"

ree
  • 1
  • What did you add to your `Linker->Input -> Additional Dependencies` setting for your project? – drescherjm Oct 25 '21 at 15:35
  • From the documentation, you should have added `libprotobufd.lib` in the debug configuration and `libprotobuf.lib` in the release configuration. Related: [https://github.com/protocolbuffers/protobuf/blob/master/cmake/README.md#installing](https://github.com/protocolbuffers/protobuf/blob/master/cmake/README.md#installing) – drescherjm Oct 25 '21 at 15:50
  • @drescherjm: I added the libprotobuf.lib to the additional dependencies – ree Oct 28 '21 at 14:41
  • That would be wrong for the debug configuration but correct for release. – drescherjm Oct 28 '21 at 14:44
  • @drescherjm: do you know why i get this error when trying to run this C:\Path\to\protobuf\cmake\build\release>cmake -G "NMake Makefiles" ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_INSTALL_PREFIX=../../../../install ^ ../... Following the steps from the README.file . The error is The system cannot find the file specifiedNMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"' : return code '0xffffffff' Stop. – ree Nov 03 '21 at 17:11
  • I don't. You probably should ask a new question adding a [mcve] and your CMakeLists.txt that produces the error you see. – drescherjm Nov 03 '21 at 17:13
  • I just tested the build instructions on windows 10 with Visual Studio 2019 and the instructions on how to build this worked without any issue. I used this on the git clone line: `git clone -b v3.19.1 https://github.com/protocolbuffers/protobuf.git` – drescherjm Nov 03 '21 at 17:35
  • I did get a `U1077` error on 4 of the tests when doing nmake check. 2314 tests passed out of 2318 – drescherjm Nov 03 '21 at 17:39
  • hmm so strange, not sure then why I'm getting this error – ree Nov 04 '21 at 20:58

0 Answers0