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

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.

Related

Use XrSceneLib_uwp in a native HoloLens 2 OpenXR application

I'm trying to create a native HoloLens 2 C++ application with OpenXR. In the Microsoft OpenXR-MixedReality example I discovered the XrSceneLib_uwp project which has the configuration type set as static library (.lib) in the Visual Studio properties. Accordingly to that I tried to add it as a library in my solution which also has a Core Application (C++/WinRT) in it where I want to use the functions from XrSceneLib_uwp. In my thinking it makes sens because I can use the library for example to create a holographic title scene without much effort. The problem here is that when I build my solution I'm getting linker errors and I don't know how to fix them. I'm also relatively new to Visual Studio (22 in my case) and most likely I'm just doing someting wrong in the linking process.
Linker error when I try to build:
Error LNK2019 unresolved external symbol xrGetInstanceProcAddr referenced in function "public: __cdecl `anonymous namespace'::ImplementXrApp::ImplementXrApp(struct engine::XrAppConfiguration)" (??0ImplementXrApp#?A0x934f03db##QEAA#UXrAppConfiguration#engine###Z) CoreApp3 \repos\CoreApp3\CoreApp3\XrSceneLib_uwp.lib(XrApp.obj) 1
My solution explorer
Here is what I do:
I copy and paste the shared and openxr_preview folders from the OpenXR-MixedReality .zip file in my project folder.
Add XrSceneLib_uwp.vcxproj in /shared/XrSceneLib as an existing project to my solution.
Add the path to the copied shared and openxr_preview folders in Properties->Configuration Properties->C/C++->General->Additional Include Directories.
Add also the path to XrSceneLib_uwp.vcxproj in Additional Include Directories in my main project (CoreApp).
Add reference in CoreApp to XrSceneLib_uwp (Add->Reference->Projects).
After that everything works fine and I can even build the solution. But when I try to use the library I'm getting these linker errors. I don't understand why it works in the OpenXR-MixedReality examples but not when I try to implement it on an different project. What am I missing? I assume that XrSceneLib may not have been designed to be used externally in other projects but at the same time I think it should be possible somehow.
I also tried to add Additional Library Directories and the missing object files but either I have done something wrong or it just simply does not work.
I really appreciate any help.
I think the linker is failing to find the OpenXR Loader. The sample projects in the microsoft/OpenXR-MixedReality github repo link to the OpenXR Loader using the NuGet package manager. I get the same linker error if I purposely remove the NuGet package references from the sample projects.
You can either link to the OpenXR Loader using NuGet or you can build the OpenXR Loader youself. Take a look at the "Using OpenXR in an existing project" section on the microsoft site:
https://learn.microsoft.com/en-us/windows/mixed-reality/develop/native/openxr-getting-started#using-openxr-in-an-existing-project

Node Addon node-gyp build missing V8 dll's

I’m trying to compile the node-addon example taken from :
https://nodejs.org/dist/latest-v6.x/docs/api/addons.html
I’m trying to do it on an offline system.
I’ve pointed node-gyp configure to a local source of node using –nodedir.
My problem is I’m getting a load of linker errors (9 in total) when I come to node-gyp build.
1>hello.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class v8::Isolate * __cdecl v8::Isolate::GetCurrent(void)" (__imp_?GetCurrent#Isolate#v8##SAPEAV12#XZ)
and I don’t really understand why.
From what i understand the error is telling me that the header file i'm using (v8.h) needs a dll.
I’ve build both the node source and the v8 source and I can’t find any dll’s, just a bunch of .lib files in node…\build\release\libs.
I think it may have something to do with BUILDING_V8_SHARED nor USING_V8_SHARED but not sure how to set them.
Changing the Visual Studio flags in the properties does nothing.
I'm using node v6.9.4 with VS 2015 on windows 7
Thanks
Turns out this has nothing to do with the v8 libraries! The problem was the Visual Studio Solution would't compile with the node.lib file created when i built node.js from source. the .dll part was a bit of a red herring!
To get around this i built it on a system connected to the internet and copied over the folder in the .node-gyp folder (where it stores the downloaded .lib file and headers) and linked against that.
I don't know why i can't link against the .lib i had built but will let you know if i find out.

SDK Implementation lib/inc/dll

I'm using Microsoft Visual Studio and an SDK to develop an app. The SDK includes the files listed above. I'm coding in C++. I'm not sure what I need to include to be able to use the SDK.
I did the things below and tried building a simple hello world app but I keep getting the error LNK2019: unresolved external symbol_WinMain#16 referenced in function __tmainCRTStartup
What I've Done:
1)Right Click-Properties-Linker-Additional Library Directories-Changed path to where I have the lib folder on my computer.
2)Same but added the Inc folder that came with the SDK to C/C++ Additional Include Directories.
By doing the above I assume I am linking the lib and .h files to the project that came with the SDK. The SDK also came with .dll files which I have done nothing with. You can use a few different languages with the SDK so I'm not sure what I need to use and not use.
However, the header files are not showing up under external dependencies.
I guess I should note that I have tried to run it a couple times before this and am not sure if that could be causing an issue building it.
Thanks.
The error you're seeing has nothing to do with header files or source code. The error is due to you not choosing the correct Visual Studio project.
If you are writing a console program, and you defined a main() function as the entry point, then you should be choosing a Win32 Console Application project from Visual Studio.
The error stems from the program looking for the WinMain function, and that function exists when you choose a Win32 Project. Usually these projects are for building GUI-based Win32 apps.

Finding Reasons for Linking Errors in Visual Studio

I'm in the process of porting one of my project to an existing framework I've been developing. As a result I have two project, one that's the original I developed and then the ported one.
The problem I'm having is that the new project doesn't link. The error is "... unresolved external symbol ..." where the symbols should be defined in a library that's linked together with the project. By using VS command line tool dumpbin.exe I confirmed that the symbols said to be missing are in the library. The original project works fine, only by removing the library from the Linker->Input->Additional Dependencies do I get the same errors for that project.
Are there other reasons for "... unresolved external symbol ..." or am I simply not linking the library?
Details
The library in question is OpenCL.lib and the errors are "error LNK2019: unresolved external symbol _clBuildProgram#24 referenced in function ..." for all OpenCL API calls. Using the technique described in Tools for inspecting .lib files? I get the symbols for each function as one would expect.
Okay, figured it out. The library I'm linking with is only for x64 architectures, switching to that platform got it working.
Would've liked a more descriptive error from VS but what can you do...

build xerces c++ version 3 with icu

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