build xerces c++ version 3 with icu - c++

I want to build Xerces 3.1.1 with ICU using Visual c++ express 2010.
I've downloaded ICU source and built it like it says in the readme.
Now i need to build Xerces with the ICU binaries i just built.
The build instructions for version 3.1.1 in Xerces's site state that "You can also select whether the Xerces-C++ library should use ICU for transcoding" but they don't say exactly how. I looked at all the build options and the only thing i found (maybe i missed something?) that may be related is the pre processor macro list, i saw the following definition - XERCES_USE_TRANSCODER_WINDOWS.
I thought that maybe i need to change it to XERCES_USE_TRANSCODER_ICU. It's just a guess, so first i looked in the Xerces code and i saw XERCES_USE_TRANSCODER_ICU does appear (for example, they check if it's defined before including ICU headers).
So I've changed XERCES_USE_TRANSCODER_WINDOWS to XERCES_USE_TRANSCODER_ICU, added ICU include directory to the include directory path and all ICU .lib files to the linker dependencies and tried to build it like that. I get unresolved external errors:
PlatformUtils.obj : error LNK2019: unresolved external symbol "public: __thiscall xercesc_3_1::ICUTransService::ICUTransService(class xercesc_3_1::MemoryManager *)" (??0ICUTransService#xercesc_3_1##QAE#PAVMemoryManager#1##Z) referenced in function "private: static class xercesc_3_1::XMLTransService * __cdecl xercesc_3_1::XMLPlatformUtils::makeTransService(void)" (?makeTransService#XMLPlatformUtils#xercesc_3_1##CAPAVXMLTransService#2#XZ)
1>C:\cpp_lib\xerces-c-3.1.1\projects\Win32\VC10\xerces-all\XercesLib...........\Build\Win32\VC10\Debug\xerces-c_3_1D.dll : fatal error LNK1120: 1 unresolved externals
The Xerces site provide more specific instructions for building Xerces 2.8 with ICU (it won't work on version 3 because it's done through a script that isn't provided with version 3). I tried that also (although i need to use the latest version) and it also didn't work well. No .dll or .lib files were created.
Thanks.

Because I had the same problem and this is one of the first Google hits looking for it, I will give an answer although it's been some time now since you asked the question.
These are the steps to build Xerces-c in Visual Studio (worked in VS10 for me) with ICU:
Download and build ICU as described.
Open the xerces-all.sln solution file with VS.
Select the ICU Debug/Release build configuration - it sets XERCES_USE_TRANSCODER_ICU for you.
Add the include and library paths for ICU to the porperties of the XercesLib project, add the icu libs in the additional linker dependencies of that project.
Build and be happy - no need to exclude WIN32TransService.cpp

Related

C++ detours linking issue

I have problems building my code that is using static lib detours. I am trying to do an old basic CTF. For that I want to get into detours.
Whenever I try to build my .dll file I get an issue
LNK2019 unresolved external symbol _DetourTransactionBegin#0 referenced in function _DllMain#12
Now, I have built the detours library using 3 different version of the visual studio dev console.
I have tried firing 'vcvars32.bat' and then using nmake to build the library which was able to build it, but I get the above error during linking my .dll. I have also tried building it with 'vcvarsamd64_x86.bat' and then using nmake to build it which also was able to build the library, but I still get the same error as above during linking.
I have tried the usual stuff: the include folder for detours.h is added to C++/General/Additional Include Directories.
Under Linker/Additional Library Directories I added them as follows: "C:\temp\det_retry\lib.X64";"C:\temp\det_retry\lib.X86";%(AdditionalLibraryDirectories).
And also under Linker/Input/Additional Dependencies I have the following: detours.lib;%(AdditionalDependencies)
What am I missing here? This is a blocker for me for a couple of days and I am reiterating the same steps trying to figure out what's missing but I cannot see. I'd really appreciate the input.
I am sure I am using the newest version because I have downloaded (cloned) detours from the ms github page.
It appears your "Additional Library Directories" are setup incorrectly or contain invalid entries rather. They look like actual library file entries (i.e. pointing to some specific files) versus being only directories (e.g. "my/lib/path/for/my_project/"). Visual Studio's naming conventions are somewhat cryptic but they should be directory entries only. There should be an entry to whatever directory contains the detours.lib file (e.g. "MyProject/Libs/MSDetour" ... where MSDetour is a folder with the "detours.lib" in it) and then Visual Studio should find the library and link everything correctly.
As a side note, if you are using the Visual Studio developer console for building your project/solution you might want to look into CMake ... it is, in my opinion, significantly easier to work with (less "settings" digging) and maintain in the long-run.

Compiling and including OpenLDAP libraries into a C++/CX UWP app

I'm developing a VoIP application (C++/CX) targeting the Universal Windows Platform. At some point, the app needs to query an LDAP server who is keeping a phonebook directory.
As I couldn't find an equivalent of the System.DirectoryServices framework for the UWP, I tried to compile the libraries myself with no success so far. The thing is every OpenLDAP doc on how to build the project for Windows seems to be really outdated. But looking into the sources, I see they provide sample solutions up until Visual Studio vc15, so it is definitely not abandoned.
I tried to build both projects (lber and ldap) and run into many dependency problems. I needed to build Cyrus SASL libraries and OpenSSL, then put all the include paths into the project and link the enerated library objects until I successfully got both libs (olber32_a_debug.lib & oldap32_a_debug.lib) to build.
Finally, I tried to include them into my app project. Still running into some linker issues regarding cyrus.
Linker Issues LNK2019
unresolved external symbol __imp__sasl_version referenced in function _ldap_int_sasl_init [oldap32_a_debug.lib(cyrus.obj)]
unresolved external symbol __imp__sasl_dispose referenced in function _ldap_int_sasl_close [oldap32_a_debug.lib(cyrus.obj)]
unresolved external symbol __imp__sasl_errstring referenced in function _ldap_int_sasl_bind [oldap32_a_debug.lib(cyrus.obj)]
So my question is, have someone compiled OpenLDAP libraries for UWP succesfully? Is there a more recent documentation on how to do so that I'm missing? Any hint/advice on the topic will be greatly appreciated. Many thanks.

Linking a DLLs in visual studio 2013

I've already looked for solution, without a success.
I need to use a DLL supplied by third parties on Visual Studio 2013(running on (x64) Windows 10).
On machine there are both OpenCV 3.0.0 and OpenCV2.410 installed and working.
The DLL's author has provided a .lib file and He says that in order to use this DLLs in your project, you need to put some others OpenCV's dlls in the project folder( I've tried to put these DLLs in every project folder[yes I know, it has no sense, but after a lot of tries i've lost my patience])
What he supplies is an .dll and an example project( that doesn't work for me because it needs OpenCV2.1 and there are instructions needs to be translate in newest version [and I prefered don't translate nothing]).
The errors in this example project are of this kind:
error LNK2001: unresolved external symbol
fatal error LNK1120: unresolved externals
The most of them are caused by the miss of OpenCV2.1, that I don't want to install, because I'll have to use it on a program using with OpenCV 3.0.0.
In the example project folder there are:
The upper mentioned .dll
A .lib file
The header file .h
These DLLs: cv210.dll, cxcore210.dll, highgui210.dll, ...(eg. cv210d.dll)
What I've done is this:
A folder called "lib" where I insert all .dll, .lib, .h files.
Put the "lib" folder in Project properties>linker> General> Additional Library Directories
Writing the .lib file in properties>linker> Input> Additional Dependencies
Put the 'lib' pathproperties>C/C++>Additional Include Directories[I know, this has no sense too]
I get these kind of errors:
error LNK2001: unresolved external symbol
I've tried #pragma comment(lib, 'file.lib') way too.
Someone can help me?

OGRE error LNK2001: unresolved external symbol

I'm trying to get some OGRE sample to compile in VS 2013 but I keep getting the same error no matter what I do:
error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)"
The OGRE SDK comes with the boost library. Unfortunatly it is not compatible with VS2013 so I've downloaded the last version compiled using VS2013. You can find it here
The "additional Include Directories" and "additional Library Directories" are properly setup.
The error state that you are using a symbol that is declared, but not implemented, boost::system::error_category is a method of boost, that various libraries use when managing errors, it belong to the system library, the implementation of this method is in [BOOST_ROOT]\boost\libs\system\src\error_code.cpp.
The most probably cause is that your are including the OGRE's library or part of the library that include some boost's libraries that use this method.
A lot of libraries from boost are header only, but this specific library system are not, it need compilation of this .cpp: two possible fixes are compiling an .LIB or .DLL from boost (see Prepare to Use a Boost Library Binary for more info about this) and using this in your project (could be better if you would be using a lot of libraries from boost that are not header only) or the most easy fix: including the error_code.cpp file in your project and compiling again.

How to add MySQL connector/C++ 1.1 to Visual Studio 2010 project?

I'm trying to add MySQL Connector/C++ to my visual Studio 2010 project.
I followed the steps (here, mysql docs) to add it to Visual Studio (I also added Boost in the "Additional include Directories").
It asked for a "sqlstring.h" file ( How a release can miss a file ?! ), so I had it from the source files (mysql source archives).
Then, It asked for libmyql.lib, I had the lib directory of MySQL Server 5.5\lib.
And now, I'm on this error:
Error 127 error LNK1120: 31 unresolved externals C:\Users\Haks\Documents\Visual Studio 2010\Projects\ProductManager\Debug\ProductManager.exe ProductManager
Error 60 error LNK2001: unresolved external symbol "__declspec(dllimport) bool __cdecl std::operator<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??$?MDU?$char_traits#D#std##V?$allocator#D#1##std##YA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##0#0#Z) C:\Users\Haks\Documents\Visual Studio 2010\Projects\ProductManager\ProductManager\mysqlcppconn-static.lib(mysql_ps_resultset.obj) ProductManager
So, maybe it's because I got the binary release of MySQL Connector/C++ 1.1 and maybe it's not compatible with VS 2010...
But I don't find the good way to compile the source files, and I never use Boost or CMake and it's seem to be needed.
I found no reference to my problem, so if someone got a response or a good way, it will be very useful for me and a lot of people I think.
Thank you
First of all, thanx to the dar7yl for pointing in the right direction.
After spending much time debugging mysql connection (VS 2010, C++), which proves to be a much hair raising experience, I am compelled to say something about it.
(assumed you setup C++ include files directory and link directory + additional dependence file correctly, else refer to the website on point 2 for reference)
0.) Yes, we need boost library. Download boost library (search google) and unpack it into your development folder and have your c++ additional include directories point to it(boost main directory, not the boost child directory).
1.) Need to be clear on the difference in VS solution configuration mode "debug" and "release". The .lib files provided provided after full installation of MYSQL under directory ...\mysql\Connector C++ ____\lib\ has two directories of debug and opt for use with solution mode "debug" and "release" accordingly. The main difference being "debug" mode uses the extra .pdb files.
2.) http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-apps-windows-visual-studio.html gives a very detail outline for VS2008 mysql connection setup. Particularly the need to include under [Project, Properties tree view, under C++, Preprocessor] two statement of CPPCONN_PUBLIC_FUNC= and HAVE_INT8_T=1
3.) be clear which mode of connection you would like with the library, mysqlcppconn.lib is dll based while mysqlcppconn-static.lib is static based. For dll based lib, related dll mysqlcppconn.dll needs to be deposited into \windows\system32\ or other system path for access.
For static connection remember its using extern C connection so you will need libmysql.lib + libmysql.dll (libmysql.pdb if under "debug") from ...\mysql\connectorc c ___\, if not you will get the unresolved external symbol error LNK 2019. So promptly update your c++ include files directory, link include file directory, additional dependency accordingly and deposite the .dll file into system path or ....\windows\system32\
4.) At this point, things should work for some of us. And no, it didn't work for me. Reason? Library comparability issue as outlined by dar7yl. So if this is the case, download source code for the connector under http://dev.mysql.com/downloads/connector/cpp/ by select platform to source code. Unpack and it get a bit complicated from here.
No VS solution or project files? No worries, see the cmake__.txt file? that's our solution.
Download cmake and have the source directory and destination directory point to your unpacked source code directory. Then open cmake__.txt in the directory and search for keyword "boost" and update the boost directory to point to your boost directory. Run configure and set to VS 2010, check the outlined configuration and change whatever is necessary Name/Value table then press generate.
By now your project + solution files should have been generated, open it and you will see many projects. We are only concerned with mysqlcppconn and mysqlcppconn-static. check and update the include files, link files + dependency in the two project's property and compile. Drop the generated .lib + .dll (and .pdb if using "debug" mode) into the corresponding directories and your project should work now.
By this point mysql connection now works for me, hope it works for you too. Some details might be missing from the above and I do apologies.
Just a small addition to dddddd great post. If you are compiling on Windows7 then you will probably get some 'unresolved externals' from the libmysql.lib library. I found this was due to the fact that the libmysql.lib came from a 64bit installation of the server. You will need to find the 32 bit version and link with that, or just install the 32 bit server instead.
I finally got MySQL Connector/C++ working with visual Studio 2010 by downloading the source and compiling it with the same settings as my project. It still warns about SqlString library:
j:\mysql-connector-c++-1.1.0\cppconn\sqlstring.h(36): warning C4251: 'sql::SQLString::realStr' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'sql::SQLString'
but, it seems to be ok with that.