Difference between revisions of "SDKInstallation"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Put linux stuff in linux chapter)
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Documentation/Banner}}
+
{{DocBanner}}
{{Documentation/NeedsRework}}
+
 
= How to install the SDK and compile the C++ examples =
 
= How to install the SDK and compile the C++ examples =
  
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:
+
The following points are important, if you want to succeed in building C++ components and snippets:
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won't run without it)
+
* You need to have {{AOo}} and {{AOo}} SDK in the identical version
* you need to install the SDK into a directory other than the one of the OOo application
+
* You need to install the SDK into a directory other than the one of the AOO application
 +
* It is strongly recommended to install the newest Java JDK on your system
 +
* Make your operating system up to date
 +
* If you have questions, use your preferred search engine first. If this not works visit: https://forum.openoffice.org to get help.
  
 
== Installation under Mac OS X ==
 
== Installation under Mac OS X ==
{{Documentation/OSX|
+
{{Mac|
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.
+
The text below describes the installation of the SDK 4.1.0 and {{AOo}} 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.
 
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com
 
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)
+
* Install newest OpenOffice and the corresponding SDK from https://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.
+
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.
 
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:
 
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:
 
<pre>
 
<pre>
 
cd <SDK_Folder>
 
cd <SDK_Folder>
./setsdkenv_unix
+
./setsdkenv_unix # Need to run every time before you use the SDK
 
cd examples/cpp/DocumentLoader
 
cd examples/cpp/DocumentLoader
 
make
 
make
soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" & make DocumentLoader.run
+
soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" &  
 +
make DocumentLoader.run
 
</pre>
 
</pre>
 
If everything went fine, you should see a new document, with the content of <SDK_Folder>/examples/cpp/DocumentLoader/test.odt.
 
If everything went fine, you should see a new document, with the content of <SDK_Folder>/examples/cpp/DocumentLoader/test.odt.
  
Further informations see: http://www.openoffice.org/api/SDK/
+
Further informations see: https://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]]
 +
 
 +
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don't support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].
 +
 
 +
To work with the SDK and C++ use an editor of your choice.
 
}}
 
}}
  
 
== Installation under LINUX ==
 
== Installation under LINUX ==
{{Documentation/Linux|
+
{{Lin|
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0
+
The text below describe the installation of the SDK 4.1.0 for {{AOo}} 4.1.0 under Ubuntu.
 
+
* Make sure you have development tools installed:
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation.  
+
Even if you don't plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)
+
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.
+
When ready, launch :  
+
 
<pre>
 
<pre>
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz
+
sudo aptitude install gcc make build-essential
 
</pre>
 
</pre>
 
+
* Install newest OpenOffice and the corresponding SDK from https://openoffice.apache.org/downloads.html or type and run
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :
+
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted <Ooo> later)
+
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)
+
 
+
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.
+
 
+
From now on, we will always note the SDK directory installation as : <OpenOffice.org1.1_SDK>. Please don't confuse with <Ooo> which is the openoffice.org /program/ directory.
+
 
+
You can find a little complement of this chapter in <OpenOffice.org1.1_SDK>/docs/install.html
+
 
+
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :
+
 
<pre>
 
<pre>
************************************************************************
+
sudo aptitude install openoffice.org openoffice.org-dev openoffice.org-dev-doc
*
+
* SDK environment is prepared for Linux
+
*
+
* SDK = /home/smoutou/openoffice.org2.0_sdk
+
* Office = /opt/openoffice.org2.0
+
* URE =
+
* Make = /usr/bin
+
* Zip = /usr/bin
+
* C++ Compiler = /usr/bin
+
* Java = /usr/java/j2sdk1.4.2_04
+
* Special Output directory = /home/smoutou
+
* Auto deployment = YES
+
*
+
************************************************************************
+
 
</pre>
 
</pre>
If you want to check the Cpp examples, you have to launch first (as mentioned before)
+
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:
<pre>
+
./setsdkenv_unix
+
</pre>
+
in your shell and then
+
<pre>
+
<Ooo>/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
+
</pre>
+
For Openoffice.org 2.x, run instead:
+
<pre>
+
<Ooo>/program/soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager"
+
</pre>
+
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).
+
We are ready to compile our first example and to check if it works correctly. For that we go in
+
<OpenOffice.org1.1_SDK>/examples/cpp/DocumentLoader directory.
+
 
<pre>
 
<pre>
 +
cd <SDK_Folder>
 +
./setsdkenv_unix # Need to run every time before you use the SDK
 +
cd examples/cpp/DocumentLoader
 
make
 
make
</pre>
+
soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" &
will compile the example, and
+
<pre>
+
 
make DocumentLoader.run
 
make DocumentLoader.run
 
</pre>
 
</pre>
will launch the example. This example only load a Ooowriter's file (test.sxw) provided with the SDK.
+
If everything went fine, you should see a new document, with the content of <SDK_Folder>/examples/cpp/DocumentLoader/test.odt.
  
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK. 
+
Further informations see: https://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]]  
 
+
Other SDK's examples are discussed later, but you can have a look to :
+
 
+
*[[Counter_Example|Counter example]]
+
 
+
}}
+
 
+
 
+
== Installation under Solaris ==
+
{{Documentation/Linux|
+
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1
+
 
+
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)
+
 
+
Depending on which language you wish to use, you will need either:
+
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].
+
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.
+
 
+
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].
+
 
+
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.
+
 
+
<pre>
+
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh
+
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]
+
 
+
File is being checked for errors ...
+
Unpacking ...
+
All files have been successfully unpacked.
+
</pre>
+
 
+
Now navigate into the packages directory under the unpacked installation directory that was just created.
+
 
+
<pre>
+
# cd /var/tmp/unpack_openofficeorg/packages
+
</pre>
+
 
+
Go ahead an install the SDK package using pfexec.
+
 
+
<pre>
+
# pfexec pkgadd -d .
+
</pre>
+
 
+
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.
+
<pre>
+
# cd /opt/openoffice.org/basis3.1/sdk
+
# ls
+
bin/                    examples/              setsdkenv_unix.csh.in
+
classes/                idl/                    setsdkenv_unix.sh.in
+
config.guess            include/                settings/
+
config.sub              index.html              share/
+
configure.pl            lib/
+
docs/                  setsdkenv_unix
+
</pre>
+
 
+
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in <OpenOffice.org1.1_SDK>/docs/install.html
+
 
+
In order to use the SDK you need to first execute the setsdkevn_unx script in the <OpenOffice.org>/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.
+
 
+
<pre>
+
OpenOffice.org3 installation = /opt/openoffice.org3
+
GNU make 3.79.1 or higher = /usr/bin
+
C++ compiler (g++ 3.0.1 or higher) = /usr/bin
+
Zip = /usr/bin
+
Java = /usr/jdk/latest/
+
</pre>
+
  
Input the paths to your development tools when prompted.  
+
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don't support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].
  
You are now ready to use the OpenOffice SDK
+
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK
 
}}
 
}}
  
 +
{{NeedsRework|EN}}
 
== Installation under Windows ==
 
== Installation under Windows ==
{{Documentation/Windows|
+
{{Win|
  
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).
+
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for AOO on Windows).
 
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.
 
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.
 
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:
 
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:
Line 184: Line 84:
 
}}
 
}}
  
== Installing with the free MS Visual C++ Toolkit 2003 ==
+
=== Installing with the free MS Visual C++ Toolkit 2003 ===
{{Documentation/HelpNeeded|This section needs help for update because '''MS Visual C++ Toolkit 2003''' seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}
+
{{HelpNeeded|EN|This section needs help for update because '''MS Visual C++ Toolkit 2003''' seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}
 
I have installed DevCpp to have a make executable file.
 
I have installed DevCpp to have a make executable file.
 
I have downloaded the free Visual C++ Toolkit 2003 here :
 
I have downloaded the free Visual C++ Toolkit 2003 here :
Line 254: Line 154:
 
("C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin" for me).
 
("C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin" for me).
  
== Other Windows Installations descriptions ==
+
=== Other Windows Installations descriptions ===
  
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])
+
You can find in [https://web.archive.org/web/20130825024609/http://www.oooforum.org/forum/viewtopic.phtml?t=23772 old, now deprecated, OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])
  
 
1.Download and install OpenOffice.
 
1.Download and install OpenOffice.
Line 381: Line 281:
 
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].
 
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].
 
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]
 
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]
+
* [https://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]
 
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&highlight= missing files in sdk]
 
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&highlight= missing files in sdk]
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal
+
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [https://www.linuxjournal.com/article/8550 Part 1] and [https://www.linuxjournal.com/article/8608 Part 2], Linux Journal
  
 
[[Category:Tutorial]]
 
[[Category:Tutorial]]
 
[[Category:Cpp]]
 
[[Category:Cpp]]
 
[[Category:Uno]]
 
[[Category:Uno]]

Revision as of 15:01, 12 March 2021

doc OOo

How to install the SDK and compile the C++ examples

The following points are important, if you want to succeed in building C++ components and snippets:

  • You need to have Apache OpenOffice and Apache OpenOffice SDK in the identical version
  • You need to install the SDK into a directory other than the one of the AOO application
  • It is strongly recommended to install the newest Java JDK on your system
  • Make your operating system up to date
  • If you have questions, use your preferred search engine first. If this not works visit: https://forum.openoffice.org to get help.

Installation under Mac OS X

Documentation Mac Logo 40.png

The text below describes the installation of the SDK 4.1.0 and Apache OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.

  • Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com
  • Install newest OpenOffice and the corresponding SDK from https://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)
  • (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.
  • Test the SDK. Open a terminal and look for the SDK folder. Now type and run:
cd <SDK_Folder>
./setsdkenv_unix # Need to run every time before you use the SDK
cd examples/cpp/DocumentLoader
make
soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" & 
make DocumentLoader.run

If everything went fine, you should see a new document, with the content of <SDK_Folder>/examples/cpp/DocumentLoader/test.odt.

Further informations see: https://www.openoffice.org/api/SDK/ and Documentation/DevGuide

Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don't support C++ programming. Feel free to help adding this feature: For Eclipse visit OpenOffice_Eclipse_Integration. For Netbeans visit OpenOffice_NetBeans_Integration.

To work with the SDK and C++ use an editor of your choice.

Installation under LINUX

Documentation linux.png

The text below describe the installation of the SDK 4.1.0 for Apache OpenOffice 4.1.0 under Ubuntu.

  • Make sure you have development tools installed:
sudo aptitude install gcc make build-essential
sudo aptitude install openoffice.org openoffice.org-dev openoffice.org-dev-doc
  • Test the SDK. Open a terminal and look for the SDK folder. Now type and run:
cd <SDK_Folder>
./setsdkenv_unix # Need to run every time before you use the SDK
cd examples/cpp/DocumentLoader
make
soffice "-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" & 
make DocumentLoader.run

If everything went fine, you should see a new document, with the content of <SDK_Folder>/examples/cpp/DocumentLoader/test.odt.

Further informations see: https://www.openoffice.org/api/SDK/ and Documentation/DevGuide

Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don't support C++ programming. Feel free to help adding this feature: For Eclipse visit OpenOffice_Eclipse_Integration. For Netbeans visit OpenOffice_NetBeans_Integration.

Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.


Edit-find-replace.png This article should be checked for accuracy and conformity to style.

Installation under Windows

Documentation windows.png

You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for AOO on Windows). The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK. If that has been done you have already installed everything, but *wait* one very important thing you should still know of: Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be "Shell prepared for SDK". Happy coding, compiling and building now (I tell you it's easy from now on!). GanescuCarmen describes some problems he encounter when trying SDK examples under Windows : “I also use the 1.1 OO version.

I had a lots of problems. Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. It was very hard to understand what it means registry(the rdb file not the Registry itself).

I was expecting to register something in Registry but it wasn't like this. And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. I had to modify a file and to add some code for 8100 port.

But I did it and it works now.”

Installing with the free MS Visual C++ Toolkit 2003

Documentation needshelp.png This article needs help


This section needs help for update because MS Visual C++ Toolkit 2003 seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.

I have installed DevCpp to have a make executable file. I have downloaded the free Visual C++ Toolkit 2003 here : http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en

and then I have installed it. (This link is broken.)

I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat which asks any questions :

set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03

and I am ready to launch setsdkenv_windows.bat

I have modified the following file : C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx to change the port accordingly to what OOo is listening.

I have modified the makefile : added :

CC_INCLUDES = -I"C:\Program Files\Microsoft Visual C++ Toolkit 2003\include" \
              -I"C:\openoffice\OpenOffice.org2.0_SDK\include"

and added libraries too :

$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)
	-$(MKDIR) $(subst /,$(PS),$(@D))
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
ifeq "$(OS)" "WIN"
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \
	 $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib" \
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib" \
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib" \
	 "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib" 
else
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)
endif

I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++.

I find a solution of the previous problem three weeks later. My problem comes in fact from a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications : Put :

REM Set environment for C++ compiler tools, if necessary.
if defined OO_SDK_CPP_HOME call "C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat"

instead of :

REM Set environment for C++ compiler tools, if necessary.
if defined OO_SDK_CPP_HOME call "%OO_SDK_CPP_HOME%\VCVARS32.bat"

I think

 
%OO_SDK_CPP_HOME%\..\VCVARS32.bat

could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% ("C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin" for me).

Other Windows Installations descriptions

You can find in old, now deprecated, OOoForum a post entitled Guide for develop OpenOffice apps with VC++ .net (by LarsB)

1.Download and install OpenOffice.

2.Download and install OpenOffice SDK

3.Create a new folder inludecpp in <oo_sdk_path>

4.Open Dos console change directory to <oo_sdk_path>\windows\bin

4.1 run cppumaker with followig paramerers

cppumaker -BUCR -O <oo_sdk_path>\includecpp <office_programm_dir>\types.rdb 

or better with

cppumaker -Gc -BUCR -O<includes_path> <ooffice_path>\URE\misc\types.rdb <ooffice_path>\Basis\program\offapi.rdb

in recent versions.

(Attention: If you recieve a init error, copy types.rdb into the <oo_sdk_path>\windows\bin folder!) After that all hpp and hdl files should be created in <oo_sdk_path>\includecpp

5.Open Visual Studio and create a new Win32 Console Application. Applay the following changes to your project.

5.1. Tools ->Options->Projects->VC++ Directories -> Include Files Add \include directory and <oo_sdk_path>\includecpp

5.2. Tools ->Options->Projects->VC++ Directories -> Library files Add <oo_sdk_path>\windows\lib directory

5.3. Tools ->Options->Projects->VC++ Directories -> Executable files Add <office_programm_dir>\program directory (location where you installed the version of the OpenOffice)

5.4 Open the Project Settings

5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window)

5.4.2 Add the additional libraries

Properties->Linker->ComandLine in the Additional Options tab the library files isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib

6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk and compile. The source should compile without errors.

INFO : If you got the following error have a look at the solution 2 postings above! Up to now, with the steps above i got the following error, when i run the DocumentLoader example. The error is thrown, when the prog execution reach the following line:


Reference< XSimpleRegistry > xSimpleRegistry( ::cppu::createSimpleRegistry() );

with error shown below :

Error: 
Window title: Microsoft Visual C++ Debug Library 
Headline: Debug Error 
Msg: This application has requested the Runtime to terminate it in an usual way. 
Please contact the support team for more information.

If somebody has experience with this kind of error it will be nice if he could post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET

Regards Lars

François has improved the complete procedure with remarks : Following all the steps I (_francois_) encountered two problems

  • first in point 4.4.2

But there I guess it's because the procedure was meant for SDK 2 and I'm using SDK 1.1 The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib you just need to include the stlport_vc7.lib instead of stlport_vc71.lib

  • second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error

Error:

Window title: Microsoft Visual C++ Debug Libary 
Headline: Debug Error 
Msg: This application has requested the Runtime to terminate it in an usual way. 
Please contact the support team for more information.

After going on debug in the visual studio I found the following line was responsible

 
xSimpleRegistry->open( OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentLoader.rdb") ), sal_True, sal_False );

The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...

regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / "C:\ooo\office\program\types.rdb" 

regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll 
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll 
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll 
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll 

I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder

I launched my exe file and it worked, great...

Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it's a good start. If anyone has any information about that (It may actualy be documented somewhere) don't hesitate)

The Development Tools of the SDK

There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at <OOo_SDK>/docs/tools.html and also in Developer's Guide.

See also Compiler versions used by port maintainers and release engineers

See also

Personal tools