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 (context.is())
{
return context;
}
else
{
fprintf(stderr, "no component context!\n");
return 0;
}
}
What I have to do?