Help on jrtplib and jthread - c++

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.

Related

OpenCascade link error in c++ using vs2017

I am a newbie to Open Cascade.After building occt-7.3.0-vc14-64 with cmake with no error, i added inc/ in Include Directories and added win64/vc14/libd/ in Library Directories, then added only "include" in main.cpp. But after clicked debug button, i got link error as following:
Error LNK2019 unresolved external symbol "public: __cdecl
Standard_OutOfMemory::Standard_OutOfMemory(char const * const)" (??
0Standard_OutOfMemory##QEAA#QEBD#Z) referenced in function "public:
void __cdecl Standard_OutOfMemory::`default constructor closure'(void)"
(??_FStandard_OutOfMemory##QEAAXXZ)
What else should have be done?
Thanks for any help.
This error is that can't find lib that contain Standard_OutOfMemory.
Standard_OutOfMemory is a class in TKernel.dll, you should add TKernel.lib to project's Additional Dependencies, like on the image below:

libconfig- unresolved external on visual studio 2010

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.

VC++ Problems using gumbo-query (linking error)

I've got a VC++ project, and I'm attempting to use the extension of the gumbo-query library, found here. This library wraps/extends Google's gumbo-parser found here. The following is the exact steps I've taken - I'm not very familiar with importing libraries, so I've done what I do to use the Boost libraries:
In Visual Studio (VS Community 2013), under the project settings -> Configuration Properties -> C/C++ -> General I have put the path to a folder that contains all of the source files from both of the projects linked above. Specifically, I placed the .c, .cpp and .h files from the src folder of both projects and referenced these in my projects settings as an include directory.
Following the example file for the project that extends Google's gumbo-parser (found here), I added these two lines to import the library:
#include "Document.h"
#include "Node.h"
At this point, my solution compiles fine. However, continuing to follow the example file, adding the first variable declaration:
CDocument d;
Causes a linker error, as follows:
1>Main.obj : error LNK2028: unresolved token (0A0003B7) "public: __thiscall CDocument::CDocument(void)" (??0CDocument##$$FQAE#XZ) referenced in function "private: void __clrcall MyApplication::Main::worker_DoWork(class System::Object ^,class System::ComponentModel::DoWorkEventArgs ^)" (?worker_DoWork#Main#MyApplication##$$FA$AAMXP$AAVObject#System##P$AAVDoWorkEventArgs#ComponentModel#4##Z)
1>Main.obj : error LNK2028: unresolved token (0A0003B8) "public: virtual __thiscall CDocument::~CDocument(void)" (??1CDocument##$$FUAE#XZ) referenced in function "private: void __clrcall MyApplication::Main::worker_DoWork(class System::Object ^,class System::ComponentModel::DoWorkEventArgs ^)" (?worker_DoWork#Main#MyApplication##$$FA$AAMXP$AAVObject#System##P$AAVDoWorkEventArgs#ComponentModel#4##Z)
1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall CDocument::CDocument(void)" (??0CDocument##$$FQAE#XZ) referenced in function "private: void __clrcall MyApplication::Main::worker_DoWork(class System::Object ^,class System::ComponentModel::DoWorkEventArgs ^)" (?worker_DoWork#Main#MyApplication##$$FA$AAMXP$AAVObject#System##P$AAVDoWorkEventArgs#ComponentModel#4##Z)
1>Main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CDocument::~CDocument(void)" (??1CDocument##$$FUAE#XZ) referenced in function "private: void __clrcall MyApplication::Main::worker_DoWork(class System::Object ^,class System::ComponentModel::DoWorkEventArgs ^)" (?worker_DoWork#Main#MyApplication##$$FA$AAMXP$AAVObject#System##P$AAVDoWorkEventArgs#ComponentModel#4##Z)
1>..{omitted}..\MyApplication.exe : fatal error LNK1120: 4 unresolved externals
This error appears to occur no matter where I put a CDocument instantiation.
What can I do to rectify this? VS seems to think the includes are fine, and moreso when I put in CDocument d; it lights up to show it recognises the CDocument type.
As always, it's clear I've been a JS developer for too long. I really did need to compile a .lib file. Thank you to Christian for reminding me of this.
The original gumbo-parser project by Google includes a VS project. I opened this and compiled it, fixing all of the project settings problems so that I could import it into my project, which I did via the Configuration Properties -> Linker -> Input -> Additional Dependencies setting for my VS project.
Next, I added the extra source files from the wrapper library gumbo-query, where I had to fix a naming conflict between parser.h/parser.cpp from the original gumbo-parser project and the Parser.h/Parser.cpp file in the wrapper library. I also changed all references to #include <gumbo.h> to #include "gumbo.h"
Eventually, I got a gumbo.lib file containing both the original and the wrapper libraries, and this imported into my project and I now seem to be able to successfully use the functions.

Protobuffers in c++ and error LNK2019: unresolved external symbol

I am new to c++ and visual studio 2012 so probably the problem is between the screen and the chair. I performed the following steps;
I made a simple proto file with the option optimize_for = LITE_RUNTIME
Create the matching h and c files with protoc
Compiled the library libprotobuf-lite.lib
Created a new console Visual Studio 2012 project.
Copied the libprotobuf-lite.lib where my single source file is.
Created a new folder named protobuffers
Copied the c, h and the google directory from the protobuffers src directory to the protobuffers folder
Added the protobuffers folder as an Additional Include Directory
Added the library file to the linker through Additional Dependencies
Compiled the following source file;
#include <iostream>
#include "protobuffers\genome.pb.h"
int main()
{
genomeMessage::Genome genome;
return 0;
}
Stuck... I get the following error;
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome#genomeMessage##QEAA#XZ) referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome#genomeMessage##UEAA#XZ) referenced in function main
1>C:\Projects\testproto\x64\Debug\testproto.exe : fatal error LNK1120: 2 unresolved externals
So I know it is not a missing lib file because if I move the lib file the linker complains that it can't find it. The problem is that I have no clue how to fix this ... anyone?
According to this message:
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl genomeMessage::Genome::Genome(void)" (??0Genome#genomeMessage##QEAA#XZ) referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl genomeMessage::Genome::~Genome(void)" (??1Genome#genomeMessage##UEAA#XZ) referenced in function main
the source file that declares genomeMessage::Genome::Genome(void) and genomeMessage::Genome::~Genome(void) is not part of your project.
In particular, it sounds like you haven't added the genome.pb.cc file (which is created by the Protocol Buffers compiler) to your project.

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.