Working with UNO on Fedora Linux 64 bits after add references to the SDK libraries libuno_cppu.so, libuno_cppuhelpergcc3.so, libuno_purpenvhelpergcc3.so, libuno_sal.so and libuno_salhelpergcc3.so in the folder /usr/lib64/libreoffice/sdk/lib and add as linking path the folder /usr/lib64/libreoffice/program I get the following error on my IDE (codeblocks 20.03)
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to unoidl::Manager::createCursor(rtl::OUString const&) const' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
xmlreader::XmlReader::registerNamespaceIri(xmlreader::Span const&)’
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to xmlreader::Span::convertFromUtf8() const' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
vtable for unoidl::Manager’
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to unoidl::Manager::addProvider(rtl::OUString const&)' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
initRegistry_Api’
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to xmlreader::XmlReader::~XmlReader()' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
xmlreader::XmlReader::getAttributeValue(bool)’
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to unoidl::Manager::findEntity(rtl::OUString const&) const' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
xmlreader::XmlReader::nextAttribute(int*, xmlreader::Span*)’
/usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to xmlreader::XmlReader::XmlReader(rtl::OUString const&)' /usr/bin/ld: /usr/lib64/libreoffice/sdk/lib/libuno_cppuhelpergcc3.so: undefined reference to
xmlreader::XmlReader::nextItem(xmlreader::XmlReader::Text, xmlreader::Span*, int*)’
collect2: error: ld returned 1 exit status
What are the libs and paths to link the UNO library right in an application?
I’m doing an application to make reports in calc ods files, I need the objects and methods in the UNO library to create and manipulate these files. At the beginning I don’t understood much the philosophy of the library but after doing an extensive read to the poor quality documentation of UNO I finally make a little progress. After successfully compile a own library that have a method to create an ods file now I’m just making a console application to test it. But it not compile and shows the error I posted…
In my lib header I have
#include <stdio.h>
#include <wchar.h>
#include <sal/main.h>
#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <string.h>
#include "appset.h"
#include "interop.h"
using namespace std;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::frame;
using namespace com::sun::star::sheet;
using namespace cppu;
using namespace canonbit_definitions::interoperatibility;
using ::rtl::OUString;
using ::rtl::OUStringToOString;
static Reference<XComponentContext> x_context;
static Reference<XMultiComponentFactory> x_service_client;
static Reference<XDesktop2> x_component_loader;
static Reference<XComponent> x_component;
static Reference<XSpreadsheetDocument> spread_sheet_doc;
static Reference<XSpreadsheets> spread_sheet_sheets_set;
static Reference<XSpreadsheet> spread_sheet_sheet;
ATTRS int ODSLoad();
ATTRS int ODSCreateFile(const string& full_file_name);
In the source file I have
int ODSLoad()
{
connection_string=OUString("uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager;");
resolver_namespace=OUString("com.sun.star.bridge.UnoUrlResolver");
x_context=Reference<XComponentContext>(bootstrap());
x_service_client=Reference<XMultiComponentFactory>(x_context->getServiceManager());
x_component_loader=Desktop::create(x_context);
return 0;
}
int ODSCreateFile(const string& full_file_name)
{
OUString calc_doc_url=StringToOUString(full_file_name);
x_component=Reference<XComponent>(
x_component_loader->loadComponentFromURL(
calc_doc_url,
OUString("_blank"),
0,
Sequence<::com::sun::star::beans::PropertyValue>()
)
);
spread_sheet_doc=Reference<XSpreadsheetDocument>(x_component,UNO_QUERY);
spread_sheet_sheets_set=spread_sheet_doc->getSheets();
Any sheet = spread_sheet_sheets_set->getByName(OUString::createFromAscii("Sheet1"));
spread_sheet_sheet=Reference<XSpreadsheet>(sheet,UNO_QUERY);
}
In the console application I just add the reference to the libs I mention at begginng and the same headers as the lib