libconfig- unresolved external on visual studio 2010 - c++

I'm trying to compile a code with the libConfig library on Windows, in Visual Studio.
This is the code:
#include "libconfig.hh"
using namespace libconfig;
int main(int argc, char * argv[])
{
Config cfg;
return 0;
}
I downloaded the library from here. On Additional Include Directories, I added the folder with all the sources and headers.
The error I get for that code is:
1>LibConfigTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall libconfig::Config::~Config(void)" (__imp_??1Config#libconfig##UAE#XZ) referenced in function _main
1>LibConfigTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall libconfig::Config::Config(void)" (__imp_??0Config#libconfig##QAE#XZ) referenced in function _main
1>c:\users\***\visual studio 2010\Projects\LibConfigTest\Debug\LibConfigTest.exe : fatal error LNK1120: 2 unresolved externals
I also compiled the example code and it succeeded, so I looked at the properties, Additional Include Files and compared it to mine and it was the same.
I can't see any other differences between the codes.
I don't know what am I missing and be happy for some guidance on that one.

You'll have to also link the library. Maybe the headers have in them some pragma link but even in that case you'll have to include the path for the library somehow. Look for Library Directories, C/C++ Additional Include Directories... if there is no pragma link you'll have to add the lib explicitly at Linker | Input | Additional Dependencies. The path to the library will have to be specified at VC Directories | Library Directories.

Related

QCustomPlot linker

I would like to use the features of QCustomPlot to draw some results from my openCV projects.
I didn't find a way to include QCustomPlot to my Microsoft Visual Studio 2010. I have included or course the cpp and h file into my project. But, I think what is still missing for me is regarding its linker and the additional dependencies (.lib file)
1>moc_ex4.obj : error LNK2019: unresolved external symbol "public: void __thiscall ex4::plot_graphs(void)" (?plot_graphs#ex4##QAEXXZ) referenced in function "private: static void __cdecl ex4::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall#ex4##CAXPAVQObject##W4Call#QMetaObject##HPAPAX#Z)
1>C:\Users\310114602\Documents\Visual Studio 2010\Projects\ex4_120313\Win32\Debug\\ex4.exe : fatal error LNK1120: 1 unresolved externals
I searched for it but no results.
Where shall I download it?
It looks like you either didn't moc your cpp file or you simply forgot to compile and link against the moc generated .cpp file.

Linking with glog library

I'm trying to use the glog logging library (LINK).
In VS2012 (I'm on Windows 8 Professional 64-bit (Japanese)), I create an empty solution with a single main.cpp file like the one in the documentation (LINK).
Also I import the glog project inside the solution (either the dll one or the static library one) and set the project dependency.
To avoid some errors I have to comment out line 97 from port.h:
/* In windows-land, hash<> is called hash_compare<> (from xhash.h) */
#define hash hash_compare
While glog compiles, the main application gives me unresolved external symbol erros (with both dll and static version).
1>main.obj : error LNK2019: 未解決の外部シンボル "void __cdecl google::InitGoogleLogging(char const *)" (?InitGoogleLogging#google##YAXPBD#Z) が関数 _main で参照されました。
1>main.obj : error LNK2019: 未解決の外部シンボル "public: __thiscall google::LogMessage::LogMessage(char const *,int)" (??0LogMessage#google##QAE#PBDH#Z) が関数 _main で参照されました。
1>main.obj : error LNK2019: 未解決の外部シンボル "public: __thiscall google::LogMessage::~LogMessage(void)" (??1LogMessage#google##QAE#XZ) が関数 _main で参照されました。
I'm compiling as Win32.
If I check the debug folder it actually contains the dll+lib or static lib file.
I also tried linking to the library manually without using the visual studio dependency system, but it's the same.
I've built glog for MSVS2012 from trunk (little patch mentioned in header already presented here, as i know), so it works for me.
Looks like your dependency description of glog library is missing.
Can you add windows-specific
#pragma comment(lib, "path_to_glog_from_project_dir.lib")
to one of your project files, for example, directly into main.cpp and test it.

Keep getting error LNK2019: unresolved external symbol

The IDE I use is Visual Studio 2010 Professional, and the library I use is ICU4C 4.8.1 for Win32 for MSVC10.
I have rebuilt all the source codes according to the manual for both Debug and Release, and all tests are successfully passed.
Then I do in the way I do with Boost.
I included \include in C/C++ > Additional Include Directories in Proprieties, which seems to be fine.
I also included \lib in Linker > Additional Library Directories.
However, I keep getting error LNK2019: unresolved external symbol.
Source Code:
#include <unicode/uchar.h>
int main () {
UBool b = u_isprint('c');
return 0;
}
Error
1>ClCompile:
1> Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol _u_isprint_48 referenced in function _main
1>C:\Users\ ... \Documents\Visual Studio\Finger-Printing-Non-ASCII\Debug\Finger-Printing-Non-ASCII.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
Apart from setting additional include directories and library directories, you have to actually link to the library. Go to Project Properties -> Linker -> Input and write the name to the .lib in Additional dependencies textbox. HTH

Help on jrtplib and jthread

I have some link error problems when trying to compile using jrtplib and jthread on my simple project. The errors are:
Error 4 fatal error LNK1120: 3 unresolved externals C:\Users\Chicko\Desktop\tryout\Debug\tryout.exe
Error 1 error LNK2019: unresolved external symbol "public: virtual __thiscall RTPSession::~RTPSession(void)" (??1RTPSession##UAE#XZ) referenced in function _wmain tryout.obj
Error 2 error LNK2019: unresolved external symbol "public: __thiscall RTPSessionParams::RTPSessionParams(void)" (??0RTPSessionParams##QAE#XZ) referenced in function _wmain tryout.obj
Error 3 error LNK2019: unresolved external symbol "public: __thiscall RTPSession::RTPSession(class RTPRandom *,class RTPMemoryManager *)" (??0RTPSession##QAE#PAVRTPRandom##PAVRTPMemoryManager###Z) referenced in function _wmain tryout.obj
and here is my main program:
// tryout.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <rtpsession.h> //Confused to put "" or <>
#include <rtpsessionparams.h>
#include <rtpudpv4transmitter.h>
int _tmain(int argc, _TCHAR* argv[])
{
RTPSession session;
RTPSessionParams sessionparams;
RTPUDPv4TransmissionParams transparams;
sessionparams.SetOwnTimestampUnit(1.0/8000.0);
transparams.SetPortbase(8000);
return 0;
}
For your information, I do not import any header file from those libraries into my project. I use additional include libraries in the project setting and put `"..\jlib\jthread-1.2.1\src";"..\jlib\jrtplib3.8.2\src" (this is the folder where all the headers are stored). How do I fix this? Where should i put jrtplib.lib and jthread.lib? Please help...
Have you added jrtplib.lib and jthread.lib under your project linker options?
You can do this on the project property page under
"Configuration properties->Linker->Input->Additional Dependencies" and make sure that the directory that contains the lib files has been added to your library path: Either on the project properties
"Linker->General->Additional Library Directories"
or under the global VS settings (Doesn't apply to VC2010)
"Tools->Options" "Projects and Solutions->VC++ Directories->Library Files"
Under VC2010 you'll have to edit the property sheet of the project.
I see that it's a bit late to answer and I'm not so expert on Windows (I'm more a Linux user), but some day ago I've tried JRTPLIB on Windows and I had the same problem when I compiled the example in release mode and the lib in debug mode (I see that you use the debug mode). Hope it can help.

Trying to compile program that uses zlib. Link unresolved error

While trying to compile program, that uses zlib, i got following errors:
Error 1 error LNK2019: unresolved
external symbol _compress referenced
in function "void __cdecl
save_image_in_pakfile(class
std::basic_ofstream > &,struct
_IplImage *)" (?save_image_in_pakfile##YAXAAV?$basic_ofstream#DU?$char_traits#D#std###std##PAU_IplImage###Z) buffer_management.obj
Error 2 error LNK2001: unresolved
external symbol
_compress fern_based_point_classifier.obj
And two more same errors but related to uncompress function.
I use the vs2008 C++, and at the project properties I added in
C/C++ : Additional include directories the path to header files of zlib.
And at linker properties I added at additional dependencies:
zlibwapi.lib and zlibstat.lib files.
How to resolv the problem?
If I made some mistakes please show me them..