[Solved] Compiling DocumentLoader Example with 2.4 SDK

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Compiling DocumentLoader Example with 2.4 SDK

Postby msmith68 » Wed May 28, 2008 5:25 pm

We have a C++ application that uses the uno interface to open ODT files and convert them to PDF files. It was initially designed and built using OpenOffice.org 2.1 and OpenOffice.org_2.1_sdk. The design was based on the DocumentLoader example that comes with the SDK. Recently we decided to upgrade to OpenOffice.org 2.4 and found that our application does not work with this newer version of OpenOffice. I had assumed that this problem could be resolved by simply installing the OpenOffice.org_2.4_sdk and rebuilding our application. However our application does not successfully compile with the new SDK, a number of errors were generated.

To get a handle on the problem, I took a step back and tried to compile and run the DocumentLoader example that comes with the SDK. It too failed to compile successfully. I suspect that if I can resolve the issues with the DocumentLoader example I will solve the problems I am having with our application.

I am working on a Window XP machine and using Visual Studio 2005 (VC 8.0). Here are the environment setting that are made when I run the setsdkenv_windows.bat before building the DocumentLoader example:

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

******************************************************************
*
* SDK environment is prepared for Windows
*
* SDK = C:\Program Files\OpenOffice.org_2.4_SDK
* Office = C:\Program Files\OpenOffice.org 2.4
* URE =
* Make = C:\mingw\bin
* Zip = c:\gzip
* C++ Compiler = C:\Program Files\Microsoft Visual Studio 8\VC\bin
* C# and VB.NET compilers = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
* Java = C:\Program Files\Java\jre1.6.0_05
* Special Output directory = c:\temp
* Auto deployment = YES
*
******************************************************************

Here is the output generated in the command prompt during the DocumentLoader project make:

../../../config.guess: not found
mkdir c:\\temp\\OpenOffice.org_2.4_SDK\\WINexample.out\\bin
mkdir: directory "c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\bin": Cannot create a file when that file already exists.
mingw32-make: [c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/bin/DocumentLoader.rdb] Error 1 (ignored)
del c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\bin\DocumentLoader.rdb
process_begin: CreateProcess((null), del c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\bin\DocumentLoader.rdb, ...) failed.
make (e=2): The system cannot find the file specified.

mingw32-make: [c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/bin/DocumentLoader.rdb] Error 2 (ignored)
"C:\Program Files\OpenOffice.org_2.4_SDK/windows/bin/regmerge" c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/bin/DocumentLoader.rdb / "C:\Program Files\OpenOffice.org 2.4\program\types.rdb"
mkdir c:\\temp\\OpenOffice.org_2.4_SDK\\WINexample.out\\misc
mkdir: directory "c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\misc": Cannot create a file when that file already exists.
mingw32-make: [c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/misc/cpp_DocumentLoader_types.flag] Error 1 (ignored)
del c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\misc\cpp_DocumentLoader_types.flag
process_begin: CreateProcess((null), del c:\temp\OpenOffice.org_2.4_SDK\WINexample.out\misc\cpp_DocumentLoader_types.flag, ...) failed.
make (e=2): The system cannot find the file specified.

mingw32-make: [c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/misc/cpp_DocumentLoader_types.flag] Error 2 (ignored)
"C:\Program Files\OpenOffice.org_2.4_SDK/windows/bin/cppumaker" -Gc -BUCR -Oc:/temp/OpenOffice.org_2.4_SDK/WINexample.out/inc/DocumentLoader -Tcom.sun.star.lang.XMultiServiceFactory -Tcom.sun.star.lang.XComponent -Tcom.sun.star.beans.XPropertySet -Tcom.sun.star.bridge.XUnoUrlResolver -Tcom.sun.star.frame.XComponentLoader -Tcom.sun.star.lang.XMultiComponentFactory -Tcom.sun.star.container.XHierarchicalNameAccess -Tcom.sun.star.registry.XSimpleRegistry c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/bin/DocumentLoader.rdb
echo flagged > c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/misc/cpp_DocumentLoader_types.flag
mkdir c:\\temp\\OpenOffice.org_2.4_SDK\\WINexample.out\\obj\\DocumentLoader
cl -c -MT -Zm500 -wd4251 -wd4275 -wd4290 -wd4675 -wd4786 -wd4800 -Zc:forScope -GR -EHa -Zc:wchar_t- -I. -Ic:/temp/OpenOffice.org_2.4_SDK/WINexample.out/inc/examples -I../../../include -Ic:/temp/OpenOffice.org_2.4_SDK/WINexample.out/inc/DocumentLoader -DWIN32 -DWNT -DCPPU_ENV=msci -Foc:\\temp\\OpenOffice.org_2.4_SDK\\WINexample.out\\obj\\DocumentLoader\\DocumentLoader.obj DocumentLoader.cxx
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

DocumentLoader.cxx
DocumentLoader.cxx(91) : error C2027: use of undefined type 'com::sun::star::registry::XSimpleRegistry'
../../../include\cppuhelper/bootstrap.hxx(57) : see declaration of 'com::sun::star::registry::XSimpleRegistry'
DocumentLoader.cxx(91) : error C2039: 'open' : is not a member of 'com::sun::star::uno::Reference<interface_type>'
with
[
interface_type=com::sun::star::registry::XSimpleRegistry
]
DocumentLoader.cxx(109) : error C2065: 'XMultiComponentFactory' : undeclared identifier
DocumentLoader.cxx(110) : error C2027: use of undefined type 'com::sun::star::uno::XComponentContext'
../../../include\cppuhelper/bootstrap.hxx(58) : see declaration of 'com::sun::star::uno::XComponentContext'
DocumentLoader.cxx(110) : error C2039: 'getServiceManager' : is not a member of 'com::sun::star::uno::Reference<interface_type>'
with
[
interface_type=com::sun::star::uno::XComponentContext
]
DocumentLoader.cxx(110) : error C2514: 'com::sun::star::uno::Reference' : class has no constructors
../../../include\com/sun/star/uno/Reference.h(192) : see declaration of 'com::sun::star::uno::Reference'
DocumentLoader.cxx(116) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'com::sun::star::uno::Reference' (or there is no acceptable conversion)
../../../include\com/sun/star/uno/Reference.h(372): could be 'interface_type *com::sun::star::uno::Reference<interface_type>::operator ->(void) throw() const'
while trying to match the argument list '(com::sun::star::uno::Reference)'
DocumentLoader.cxx(116) : error C2039: 'createInstanceWithContext' : is not a member of 'com::sun::star::uno::Reference'
../../../include\com/sun/star/uno/Reference.h(192) : see declaration of 'com::sun::star::uno::Reference'
DocumentLoader.cxx(142) : error C2027: use of undefined type 'com::sun::star::uno::XComponentContext'
../../../include\cppuhelper/bootstrap.hxx(58) : see declaration of 'com::sun::star::uno::XComponentContext'
DocumentLoader.cxx(142) : error C2039: 'getServiceManager' : is not a member of 'com::sun::star::uno::Reference<interface_type>'
with
[
interface_type=com::sun::star::uno::XComponentContext
]
DocumentLoader.cxx(142) : error C2514: 'com::sun::star::uno::Reference' : class has no constructors
../../../include\com/sun/star/uno/Reference.h(192) : see declaration of 'com::sun::star::uno::Reference'
DocumentLoader.cxx(148) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'com::sun::star::uno::Reference' (or there is no acceptable conversion)
../../../include\com/sun/star/uno/Reference.h(372): could be 'interface_type *com::sun::star::uno::Reference<interface_type>::operator ->(void) throw() const'
while trying to match the argument list '(com::sun::star::uno::Reference)'
DocumentLoader.cxx(148) : error C2039: 'createInstanceWithContext' : is not a member of 'com::sun::star::uno::Reference'
../../../include\com/sun/star/uno/Reference.h(192) : see declaration of 'com::sun::star::uno::Reference'
mingw32-make: *** [c:/temp/OpenOffice.org_2.4_SDK/WINexample.out/obj/DocumentLoader/DocumentLoader.obj] Error 2


As you can see there are a number of errors generated when the DocumentLoader.cxx file is compiled. Any idea what is causing these errors? The DocumentLoader example compiles without problem with the 2.1 SDK using the same compiler.
Last edited by msmith68 on Thu May 29, 2008 8:39 pm, edited 1 time in total.
msmith68
 
Posts: 3
Joined: Wed May 28, 2008 3:35 pm

Re: Compiling DocumentLoader Example with 2.4 SDK

Postby msmith68 » Thu May 29, 2008 8:38 pm

I found out what was causing the errors when I tried to compile the DocumentLoader example and my application. The bootstrap.hxx header file in the C:\Program Files\OpenOffice.org_2.4_SDK\include\cppuhelper directory has been in the 2.4 SDK. The following includes were removed:

#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>

When I put them back in the DocumentLoader example successfully compiled and so did my application. When I ran the resulting DocumentLoader.exe it failed with the following error:

Error: cannot establish a connection using 'uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager':
Connector : couldn't connect to socket (WSANOTINITIALISED, WSAStartup() has not been called)

I verified that soffice was running and listening on the 2083 port so I suspect there is a problem with OpenOffice 2.4. My application had the same problem when I ran it. I removed OpenOffice 2.4 from the machine and reinstalled OpenOffice 2.2 and both the DocumentLoader example and my application ran successfully, using the executables compiled with the 2.4 SDK. So it appears there is a bug in OpenOffice 2.4.

So I guess I should close this thread and go to the issuetracker and report the bug.
msmith68
 
Posts: 3
Joined: Wed May 28, 2008 3:35 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest