Error while building an application using protobuf on VS2013 - c++

I'm new to protobuf. I did the tutorials proposed by Google and everything was fine. I'm now trying to make my own application working and I get an error that I don't understand.
Error 1 error LNK2019: unresolved external symbol __imp__close referenced in function "public: bool __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Close(void)" (?Close#CopyingFileInputStream#FileInputStream#io#protobuf#google##QAE_NXZ) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 2 error LNK2019: unresolved external symbol __imp__read referenced in function "public: virtual int __thiscall google::protobuf::io::FileInputStream::CopyingFileInputStream::Read(void *,int)" (?Read#CopyingFileInputStream#FileInputStream#io#protobuf#google##UAEHPAXH#Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
Error 3 error LNK2019: unresolved external symbol __imp__write referenced in function "public: virtual bool __thiscall google::protobuf::io::FileOutputStream::CopyingFileOutputStream::Write(void const *,int)" (?Write#CopyingFileOutputStream#FileOutputStream#io#protobuf#google##UAE_NPBXH#Z) D:\Projets\bin\pb_decoder\libprotobuf.lib(zero_copy_stream_impl.obj) pb_decoder_pck
I didn't use protobuf in my code for now. The only thing I wrote is
#include "helloworld.pb.h"
and my helloword.proto looks like that :
syntax = "proto3";
message Hello {
int32 id = 1;
string name = 2;
}
Any idea about the problem here ?
unresolved symbols sounds like a missing like error to me but the libs are actually here.
I found a post on groups.google which was pointing out a problem quite similar to my own issue, but it didn't work for me.
Problem with linking runtime libraries on Windows for C++
Context
protobuf version 3.0
IDE : Visual Studio 2013
My application is a RTMAPS diagram (sofware quite similar to simulink), in case someone heard about this :)
Thanks guys for your help !

EDIT :answer is in the question :)
The link I gave in my question is actually the answer to my question. I just didn't correct the files correctly.
It is however strange that I'm the only one getting this error on the last version of protobuf (3.0).
Here is the link once again :
Problem with linking runtime libraries on Windows for C++
I hope it will be helpful to someone !

Related

configuration VS2010 for GreedyProjectionTriangulation

I have a code based on PCL 1.6, using functions as OrganizedFastMesh and Poisson, and it works well. But When I add this code to use GreedyProjectionTriangulation function VS2010 return this error:
*Error 51 error LNK2001: unresolved external symbol "private: virtual void __cdecl pcl::GreedyProjectionTriangulation::performReconstruction(class std::vector > &)" (?performReconstruction#?$GreedyProjectionTriangulation#UPointXYZ#pcl###pcl##EEAAXAEAV?$vector#UVertices#pcl##V?$allocator#UVertices#pcl###std###std###Z) C:...\pcl_surface.obj*
Does it need an additional file.lib to include?
Which ones? Or what else?
Thank you!
A few days ago,the same error occurred in my code (with two similar errors).
I added the lib file /lib/pcl_features_debug.lib to the linker-->input, and it works.
VS2010(X64) debug mode

unresolved external symbol _gluLookAt#72 referenced in function

I'm making a program using the glu library but when i compile i got this error:
1>opengl_3.obj : error LNK2019: unresolved external symbol _gluLookAt#72 referenced in function "public: void __thiscall OpenGLContext::setupScene(void)" (?setupScene#OpenGLContext##QAEXXZ)
I included GL/glu.h and checked if the lib and dll were present. (they are by default)
I'm using visual studio 2012.
Any idea where this error is coming from?
You are not linking to glu. Add glu to the libraries against which your program should be linked. A more detailed description can be found here.

OpenCV - SURF functionality issue

I am trying to build an OpenCV program which uses SURF matching algorithm, the code is in the following link :
http://feelmare.blogspot.ro/2011/10/sift-matching-c-source-code-using.html
However, I am obtaining 2 errors regarding some external symbols : _cvExtractSurf and _cvSURFParams.
error LNK2019: unresolved external symbol _cvExtractSURF referenced in function "public: bool __thiscall CMareMatchingClass::ExtractBGsurf(struct _IplImage *)" (?ExtractBGsurf#CMareMatchingClass##QAE_NPAU_IplImage###Z)
error LNK2019: unresolved external symbol _cvSURFParams referenced in function "public: __thiscall CMareMatchingClass::CMareMatchingClass(void)" (??0CMareMatchingClass##QAE#XZ)
Do you know how can I solve this errors? I am running the code by using opencv 2.3.0 in visual studio 2010 in Windows 7 - 64 bit.
You didn't link a needed library - try to link all OpenCV libraries in project settings. See documentation.

error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()"

I am getting the following LINK error while compiling my C++ solution:
error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8
referenced in function "protected: XYX()
The symbol "Direct3DCreate9Ex' is defined in "ddraw.h" header file found in "C:\Program Files\Microsoft SDKs\Windows\v7.0\Include". And verified that the header file "ddraw.h" is present in this location. Also I have included this path in VS settings "Tools-->Options-->VC++ Directories -> Includes".
But still I am getting the link error as "error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()" ".
Can anyone kindly help me in getting rid of this link error while compiling my C++ solution.
I am using VS 2008 on 64 bit Win7.
Thanks in advance.
Based on reference page for Direct3DCreate9Ex you need to link with D3D9.lib.

Linking Lua with Visual Studio 2010

We use Lua (www.lua.org) script to let users to customize our server software written in C++.
At the moment we are porting the 32 bits Windows version of our project to Visual Studio 2010.
Once everything works fine with VS 2008, we thought that we would have no problem on upgrade process.
Unfortunately whenever we tried to link the lualib (as dll) to our project in VS 2010, the lua functions could not be found by the linker (the error messages are displayed below).
It seems that some calling convention is wrong on 2010, like the application may be looking for the lua functions with a prefix '_'.
To access lua functions (written in C) from our project modules (C++) we use this:
extern "C" {
#include "lua/src/lua.h"
#include "lua/src/lualib.h"
#include "lua/src/lauxlib.h"
}
The same project compiles and links with lualib successfully on VS 2008 and Linux (g++).
Could anybody help me with this ?
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_openlibs referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_newstate referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_close referenced in function "public: void __thiscall DsCScriptEngine::Shutdown(void)" (?Shutdown#DsCScriptEngine##QAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pcall referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute#DsCScriptEngine##QAEJPBD#Z)
etc.
The reported missing names are correct, this not a compile problem. You must be linking the wrong .lib. The name you use sounds wrong, it isn't "lualib", the current version of the import library is named lua5.1.lib (or lua51.lib, not sure what the difference is). Download it from here.