link 2019 unresolved external symbol when compiles Libreoffice program on c++ [solved]

I am trying to compile a program to make sure all the code is working. I am getting an Error 2019.

I’v done all like in this article Integrating LibreOffice into C++ | Studio Freya

But have visual studio 2019 and on windows 7, Libreoffice 6.2.

And writes a little bit more include pathes in visual studiio after a couple of errors: C:\Program Files\LibreOfficeSDK\sdk\bin\out;C:\Program Files\LibreOffice\program;C:\Program Files\LibreOfficeSDK\sdk\include

But I’m still getting error:

Error LNK2019   unresolved external symbol "__declspec(dllimport) class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> __cdecl cppu::bootstrap(void)" (__imp_?bootstrap@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@XZ) in function "class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> __cdecl setContext(void)" (?setContext@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@XZ)

Full code is:

#include <iostream>

#include <string.h>
#include <stdio.h>
#include <wchar.h>

#include <sal/main.h>

#include <osl/file.hxx>
#include <osl/process.h>
#include <rtl/process.h>

#include <cppuhelper/bootstrap.hxx>

#include <com/sun/star/uno/Reference.hxx>
#include <cppu/unotype.hxx>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>

#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::bridge;
using namespace com::sun::star::frame;

using namespace rtl;
using namespace cppu;

Reference < XComponentContext > setContext(void)
    Reference < XComponentContext > context(::cppu::bootstrap());
    if (
        return context;
        fprintf(stderr, "no component context!\n");
        return 0;

What I have to do?

What I have to do?

  1. Use the official documentation from TDF wiki, which covers VS 2019, and not some random sites on the Internet.
  2. Ask development-related questions (like this one, which is about building) on development mailing list, or in the #libreoffice-dev IRC channel on FreeNode.

We only added support for VS2019 starting with LO 6.3 (commit), so you won’t be able to use it to build 6.2. IDE integration was updated in current master, so with 6.3 branch, you will only get vs2017-ide-integration (which works OK with VS 2019, and only requires a relevant toolchain installed).

Yes, sorry. It was libreoffice ver. 3.2.
The problem was in include dependencies, which I dont see in the description of the sdk installation guide.

The decision is in to go to the project settings:
Project | Properties | Configuration Properties | Linker | Input | Additional Dependency
and add there
C:\Program Files\LibreOfficeSDK\sdk\lib\icppuhelper.lib

I must admit I misunderstood you, and thought you are talking about building LibreOffice, not an application for LibreOffice made using SDK. Sorry for that.

You are right, that the documentation lacks the dependencies description. You may find SDKInstallation - Apache OpenOffice Wiki useful. And you are advised to file a bug against Documentation component.

Cross-posted to

Have you run the file setsdkenv_windows.bat? It is explained in the link given by Mike Kaganski. It has worked for me in the past, although I have not tried VS 2019. One more idea: My sdk is at C:\libreoffice5.3.1.2\sdk. It looks like yours is in C:\Program Files, which I do not think will work because it has a space in the path.

Yes, I did.
Run setsdkenv_windows.bat, then answered for all questions and then check all settings with console command ‘set’.