您的位置:首页 > 编程语言 > C语言/C++

TAO使用指南(二)——Microsoft Visual C++中开发TAO程序时的设置

2007-05-22 17:04 771 查看
一. 路径设置
1. 首先确认环境变量ACE_ROOT和TAO_ROOT已被正确设置.

2. 将(ACE_ROOT/bin)添加到PATH环境变量中. 否则会找不到DLL.

3. 在Tools->Options->Directories中, 分别添加如下目录:
Include files:
$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)/orbsvcs
Library files:
$(ACE_ROOT)/ace,$(TAO_ROOT)/tao,$(TAO_ROOT)/orbsvcs/orbsvcs
4. 也可以在
Project->Settings->C/C++->Preprocessor->Additional include directories
中添加头文件的路径.

Project->Settings->Link->Input->Additional library directories
中添加静态库文件路径.

二. 工程设置
1. Project->Settings->C/C++->Code generation:
如果工程是Debug版, 选择Debug Multithreaded DLL
如果工程是Release版, 选择Multithreaded DLL
2. Project->Settings->Link->Input->Object/library modules:
需要添加TAO的静态链接库文件:

说明 Debug版 Release版
---------------------------------------------
普通客户端: Debug版: ACEd.lib
Release版: ACE.lib
普通服务器: 在ACE.lib/ACEd.lib的基础上, 还需要添加:
Debug版: PortableServerd.lib
Release版: PortableServer.lib
如果使用了名字服务, 则需要添加 TAO_CosNaming.lib 或
TAO_CosNamingd.lib
如果使用了事件服务, 则需要添加 TAO_CosEvent.lib 或
TAO_CosEventd.lib

注意: TAO分Debug和Release版, 所以在开发时, Debug和Release版
的设置要严格区分. 即使是MS自己的库也是这样. 如对于
Debug版, 要包含MSVCRTd.lib而不是MSVCRT.lib.
---------------------------------------------------------------
TAO的文件众多, 目录结构复杂, 所以生成一个所谓的TAO SDK来方便开发.
这个TAO SDK的目录结构如下:

TAOSDK_ROOT
|
|-- bin (所有的可执行文件和动态链接库)
|-- idl (ORB的IDL文件)
|-- include (所有的头文件)
| |-- ace
| | |-- ***
| | |-- ***
| |
| |-- orbsvcs
| | |-- CosEvent
| | |-- Naming
| | |-- ***
| | |-- ***
| |
| |-- tao
| | |-- IORTable
| | |-- PortableServer
| | |-- ***
|-- lib (所有的静态库文件)

使用时, 首先创建环境变量 TAOSDK_ROOT 为TAO SDK的根目录, 然后
在VC的工程中如下设置:
添加头文件的include路径:
$(TAOSDK_ROOT)/include,$(TAOSDK_ROOT)/include/orbsvcs,$(TAOSDK_ROOT)/tao
添加静态库文件路径:
$(TAOSDK_ROOT)/lib

下面提供了一个自动生成TAO SDK的批处理文件, 将该文件置于ACE_ROOT目录下,
然后执行之...
注: 本程序来源于TAO的邮件列表.

File name: TAOSDK.bat
-------------------------------------------------------------------------
@echo off
@echo Createing directories…

mkdir ../tao/bin
mkdir ../tao/include
mkdir ../tao/include/ace
mkdir ../tao/include/ace/classix
mkdir ../tao/include/ace/qos
mkdir ../tao/include/ace/rmcast
mkdir ../tao/include/ace/ssl
mkdir ../tao/include/tao
mkdir ../tao/include/tao/BiDir_GIOP
mkdir ../tao/include/tao/Domain
mkdir ../tao/include/tao/DynamicAny
mkdir ../tao/include/tao/DynamicInterface
mkdir ../tao/include/tao/IFR_Client
mkdir ../tao/include/tao/IORManipulation
mkdir ../tao/include/tao/IORTable
mkdir ../tao/include/tao/PortableServer
mkdir ../tao/include/tao/RTCORBA
mkdir ../tao/include/tao/RTPortableServer
mkdir ../tao/include/tao/SmartProxies
mkdir ../tao/include/tao/Strategies
mkdir ../tao/include/tao/TypeCodeFactory
mkdir ../tao/include/orbsvcs
mkdir ../tao/include/orbsvcs/AV
mkdir ../tao/include/orbsvcs/Concurrency
mkdir ../tao/include/orbsvcs/CosEvent
mkdir ../tao/include/orbsvcs/ESF
mkdir ../tao/include/orbsvcs/ETCL
mkdir ../tao/include/orbsvcs/Event
mkdir ../tao/include/orbsvcs/FaultTolerance
mkdir ../tao/include/orbsvcs/LifeCycle
mkdir ../tao/include/orbsvcs/LoadBalancing
mkdir ../tao/include/orbsvcs/Log
mkdir ../tao/include/orbsvcs/Naming
mkdir ../tao/include/orbsvcs/Notify
mkdir ../tao/include/orbsvcs/Property
mkdir ../tao/include/orbsvcs/Sched
mkdir ../tao/include/orbsvcs/Security
mkdir ../tao/include/orbsvcs/SSLIOP
mkdir ../tao/include/orbsvcs/Time
mkdir ../tao/include/orbsvcs/Trader
mkdir ../tao/lib

@echo copying header files...
copy ace/*.i ../tao/include/ace
copy ace/*.inl ../tao/include/ace
copy ace/*.h ../tao/include/ace

copy ace/*.cpp ../tao/include/ace
copy ace/classix/*.i ../tao/include/ace/classix
copy ace/classix/*.h ../tao/include/ace/classix
copy ace/classix/*.cpp ../tao/include/ace/classix
copy ace/qos/*.i ../tao/include/ace/qos
copy ace/qos/*.h ../tao/include/ace/qos
copy ace/qos/*.cpp ../tao/include/ace/qos
copy ace/rmcast/*.i ../tao/include/ace/rmcast
copy ace/rmcast/*.h ../tao/include/ace/rmcast
copy ace/rmcast/*.cpp ../tao/include/ace/rmcast
copy ace/ssl/*.i ../tao/include/ace/ssl
copy ace/ssl/*.h ../tao/include/ace/ssl
copy ace/ssl/*.cpp ../tao/include/ace/ssl

copy tao/tao/*.i ../tao/include/tao
copy tao/tao/*.inl ../tao/include/tao
copy tao/tao/*.h ../tao/include/tao
copy tao/tao/*.idl ../tao/include/tao
copy tao/tao/*.cpp ../tao/include/tao
copy tao/orbsvcs/Naming_Service/*.h ../tao/include/tao
copy tao/orbsvcs/LoadBalancer/*.h ../tao/include/tao
copy tao/orbsvcs/Logging_Service/*.h ../tao/include/tao
copy tao/orbsvcs/TAO_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Time_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Naming_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Trading_Service/*.h ../tao/include/tao
copy tao/orbsvcs/ImplRepo_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Concurrency_Service/*.h ../tao/include/tao
copy tao/orbsvcs/CosEvent_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Dump_Schedule/*.h ../tao/include/tao
copy tao/orbsvcs/Event_Service/*.h ../tao/include/tao
copy tao/orbsvcs/IFR_Service/*.h ../tao/include/tao
copy tao/orbsvcs/LifeCycle_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Notify_Service/*.h ../tao/include/tao
copy tao/orbsvcs/Scheduling_Service/*.h ../tao/include/tao

copy tao/orbsvcs/orbsvcs/*.h ../tao/include/orbsvcs
copy tao/orbsvcs/orbsvcs/*.i ../tao/include/orbsvcs
copy tao/orbsvcs/orbsvcs/*.cpp ../tao/include/orbsvcs
copy tao/orbsvcs/orbsvcs/AV/*.h ../tao/include/orbsvcs/AV
copy tao/orbsvcs/orbsvcs/AV/*.i ../tao/include/orbsvcs/AV
copy tao/orbsvcs/orbsvcs/AV/*.cpp ../tao/include/orbsvcs/AV
copy tao/orbsvcs/orbsvcs/Concurrency/*.h ../tao/include/orbsvcs/Concurrency
copy tao/orbsvcs/orbsvcs/Concurrency/*.i ../tao/include/orbsvcs/Concurrency
copy tao/orbsvcs/orbsvcs/Concurrency/*.cpp ../tao/include/orbsvcs/Concurrency
copy tao/orbsvcs/orbsvcs/CosEvent/*.h ../tao/include/orbsvcs/CosEvent
copy tao/orbsvcs/orbsvcs/CosEvent/*.i ../tao/include/orbsvcs/CosEvent
copy tao/orbsvcs/orbsvcs/CosEvent/*.cpp ../tao/include/orbsvcs/CosEvent
copy tao/orbsvcs/orbsvcs/ESF/*.h ../tao/include/orbsvcs/ESF
copy tao/orbsvcs/orbsvcs/ESF/*.i ../tao/include/orbsvcs/ESF
copy tao/orbsvcs/orbsvcs/ESF/*.cpp ../tao/include/orbsvcs/ESF
copy tao/orbsvcs/orbsvcs/ETCL/*.h ../tao/include/orbsvcs/ETCL
copy tao/orbsvcs/orbsvcs/ETCL/*.i ../tao/include/orbsvcs/ETCL
copy tao/orbsvcs/orbsvcs/ETCL/*.cpp ../tao/include/orbsvcs/ETCL
copy tao/orbsvcs/orbsvcs/Event/*.h ../tao/include/orbsvcs/Event
copy tao/orbsvcs/orbsvcs/Event/*.i ../tao/include/orbsvcs/Event
copy tao/orbsvcs/orbsvcs/Event/*.cpp ../tao/include/orbsvcs/Event
copy tao/orbsvcs/orbsvcs/FaultTolerance/*.h ../tao/include/orbsvcs/FaultTolerance
copy tao/orbsvcs/orbsvcs/FaultTolerance/*.i ../tao/include/orbsvcs/FaultTolerance
copy tao/orbsvcs/orbsvcs/FaultTolerance/*.cpp ../tao/include/orbsvcs/FaultTolerance
copy tao/orbsvcs/orbsvcs/LifeCycle/*.h ../tao/include/orbsvcs/LifeCycle
copy tao/orbsvcs/orbsvcs/LifeCycle/*.i ../tao/include/orbsvcs/LifeCycle
copy tao/orbsvcs/orbsvcs/LifeCycle/*.cpp ../tao/include/orbsvcs/LifeCycle
copy tao/orbsvcs/orbsvcs/LoadBalancing/*.h ../tao/include/orbsvcs/LoadBalancing
copy tao/orbsvcs/orbsvcs/LoadBalancing/*.i ../tao/include/orbsvcs/LoadBalancing
copy tao/orbsvcs/orbsvcs/LoadBalancing/*.cpp ../tao/include/orbsvcs/LoadBalancing
copy tao/orbsvcs/orbsvcs/Log/*.h ../tao/include/orbsvcs/Log
copy tao/orbsvcs/orbsvcs/Log/*.i ../tao/include/orbsvcs/Log
copy tao/orbsvcs/orbsvcs/Log/*.cpp ../tao/include/orbsvcs/Log
copy tao/orbsvcs/orbsvcs/Naming/*.h ../tao/include/orbsvcs/Naming
copy tao/orbsvcs/orbsvcs/Naming/*.i ../tao/include/orbsvcs/Naming
copy tao/orbsvcs/orbsvcs/Naming/*.cpp ../tao/include/orbsvcs/Naming
copy tao/orbsvcs/orbsvcs/Notify/*.h ../tao/include/orbsvcs/Notify
copy tao/orbsvcs/orbsvcs/Notify/*.i ../tao/include/orbsvcs/Notify
copy tao/orbsvcs/orbsvcs/Notify/*.cpp ../tao/include/orbsvcs/Notify
copy tao/orbsvcs/orbsvcs/Property/*.h ../tao/include/orbsvcs/Property
copy tao/orbsvcs/orbsvcs/Property/*.i ../tao/include/orbsvcs/Property
copy tao/orbsvcs/orbsvcs/Property/*.cpp ../tao/include/orbsvcs/Property
copy tao/orbsvcs/orbsvcs/Sched/*.h ../tao/include/orbsvcs/Sched
copy tao/orbsvcs/orbsvcs/Sched/*.i ../tao/include/orbsvcs/Sched
copy tao/orbsvcs/orbsvcs/Sched/*.cpp ../tao/include/orbsvcs/Sched
copy tao/orbsvcs/orbsvcs/Security/*.h ../tao/include/orbsvcs/Security
copy tao/orbsvcs/orbsvcs/Security/*.i ../tao/include/orbsvcs/Security
copy tao/orbsvcs/orbsvcs/Security/*.cpp ../tao/include/orbsvcs/Security
copy tao/orbsvcs/orbsvcs/SSLIOP/*.h ../tao/include/orbsvcs/SSLIOP
copy tao/orbsvcs/orbsvcs/SSLIOP/*.i ../tao/include/orbsvcs/SSLIOP
copy tao/orbsvcs/orbsvcs/SSLIOP/*.cpp ../tao/include/orbsvcs/SSLIOP
copy tao/orbsvcs/orbsvcs/Time/*.h ../tao/include/orbsvcs/Time
copy tao/orbsvcs/orbsvcs/Time/*.i ../tao/include/orbsvcs/Time
copy tao/orbsvcs/orbsvcs/Time/*.cpp ../tao/include/orbsvcs/Time
copy tao/orbsvcs/orbsvcs/Trader/*.h ../tao/include/orbsvcs/Trader
copy tao/orbsvcs/orbsvcs/Trader/*.i ../tao/include/orbsvcs/Trader
copy tao/orbsvcs/orbsvcs/Trader/*.cpp ../tao/include/orbsvcs/Trader

copy tao/tao/BiDir_GIOP/*.h ../tao/include/tao/BiDir_GIOP
copy tao/tao/BiDir_GIOP/*.inl ../tao/include/tao/BiDir_GIOP
copy tao/tao/BiDir_GIOP/*.i ../tao/include/tao/BiDir_GIOP
copy tao/tao/Domain/*.h ../tao/include/tao/Domain
copy tao/tao/Domain/*.inl ../tao/include/tao/Domain
copy tao/tao/Domain/*.i ../tao/include/tao/Domain
copy tao/tao/DynamicAny/*.h ../tao/include/tao/DynamicAny
copy tao/tao/DynamicAny/*.inl ../tao/include/tao/DynamicAny
copy tao/tao/DynamicAny/*.i ../tao/include/tao/DynamicAny
copy tao/tao/DynamicInterface/*.h ../tao/include/tao/DynamicInterface
copy tao/tao/DynamicInterface/*.inl ../tao/include/tao/DynamicInterface
copy tao/tao/DynamicInterface/*.i ../tao/include/tao/DynamicInterface
copy tao/tao/IFR_Client/*.h ../tao/include/tao/IFR_Client
copy tao/tao/IFR_Client/*.inl ../tao/include/tao/IFR_Client
copy tao/tao/IFR_Client/*.i ../tao/include/tao/IFR_Client
copy tao/tao/IORManipulation/*.h ../tao/include/tao/IORManipulation
copy tao/tao/IORManipulation/*.inl ../tao/include/tao/IORManipulation
copy tao/tao/IORManipulation/*.i ../tao/include/tao/IORManipulation
copy tao/tao/IORTable/*.h ../tao/include/tao/IORTable
copy tao/tao/IORTable/*.inl ../tao/include/tao/IORTable
copy tao/tao/IORTable/*.i ../tao/include/tao/IORTable
copy tao/tao/PortableServer/*.h ../tao/include/tao/PortableServer
copy tao/tao/PortableServer/*.inl ../tao/include/tao/PortableServer
copy tao/tao/PortableServer/*.i ../tao/include/tao/PortableServer
copy tao/tao/RTCORBA/*.h ../tao/include/tao/RTCorba
copy tao/tao/RTCORBA/*.inl ../tao/include/tao/RTCorba
copy tao/tao/RTCORBA/*.i ../tao/include/tao/RTCorba
copy tao/tao/RTPortableServer/*.h ../tao/include/tao/RTPortableServer
copy tao/tao/RTPortableServer/*.inl ../tao/include/tao/RTPortableServer
copy tao/tao/RTPortableServer/*.i ../tao/include/tao/RTPortableServer
copy tao/tao/SmartProxies/*.h ../tao/include/tao/SmartProxies
copy tao/tao/SmartProxies/*.inl ../tao/include/tao/SmartProxies
copy tao/tao/SmartProxies/*.i ../tao/include/tao/SmartProxies
copy tao/tao/Strategies/*.h ../tao/include/tao/Strategies
copy tao/tao/Strategies/*.inl ../tao/include/tao/Strategies
copy tao/tao/Strategies/*.i ../tao/include/tao/Strategies
copy tao/tao/TypeCodeFactory/*.h ../tao/include/tao/TypeCodeFactory
copy tao/tao/TypeCodeFactory/*.inl ../tao/include/tao/TypeCodeFactory
copy tao/tao/TypeCodeFactory/*.i ../tao/include/tao/TypeCodeFactory

@echo copying libraries...
copy ace/*.lib ../tao/lib
copy ace/SSL/*.lib ../tao/lib
copy tao/tao/*.lib ../tao/lib
copy tao/tao/BiDir_GIOP/*.lib ../tao/lib
copy tao/tao/Domain/*.lib ../tao/lib
copy tao/tao/DynamicAny/*.lib ../tao/lib
copy tao/tao/DynamicInterface/*.lib ../tao/lib
copy tao/tao/IFR_Client/*.lib ../tao/lib
copy tao/tao/IORManipulation/*.lib ../tao/lib
copy tao/tao/IORTable/*.lib ../tao/lib
copy tao/tao/PortableServer/*.lib ../tao/lib
copy tao/tao/RTCORBA/*.lib ../tao/lib
copy tao/tao/RTPortableServer/*.lib ../tao/lib
copy tao/tao/SmartProxies/*.lib ../tao/lib
copy tao/tao/Strategies/*.lib ../tao/lib
copy tao/tao/TypeCodeFactory/*.lib ../tao/lib
copy tao/TAO_IDL/*.lib ../tao/lib
copy tao/orbsvcs/IFR_Service/*.lib ../tao/lib
copy tao/orbsvcs/orbsvcs/*.lib ../tao/lib

@echo copying binary files...
copy bin/*.dll ../tao/bin
copy bin/*.exe ../tao/bin
copy tao/orbsvcs/Concurrency_Service/Concurrency_Service.exe ../tao/bin/Concurrency_Serviced.exe
copy tao/orbsvcs/Concurrency_Service/Release/Concurrency_Service.exe ../tao/bin
copy tao/orbsvcs/CosEvent_Service/CosEvent_Service.exe ../tao/bin/CosEvent_Serviced.exe
copy tao/orbsvcs/CosEvent_Service/Release/CosEvent_Service.exe ../tao/bin
copy tao/orbsvcs/Dump_Schedule/Dump_Schedule.exe ../tao/bin/Dump_Scheduled.exe
copy tao/orbsvcs/Dump_Schedule/Release/Dump_Schedule.exe ../tao/bin
copy tao/orbsvcs/Event_Service/Event_Service.exe ../tao/bin/Event_Serviced.exe
copy tao/orbsvcs/Event_Service/Release/Event_Service.exe ../tao/bin
copy tao/orbsvcs/IFR_Service/IFR_Service.exe ../tao/bin/IFR_Serviced.exe
copy tao/orbsvcs/IFR_Service/Release/IFR_Service.exe ../tao/bin
copy tao/orbsvcs/ImplRepo_Service/ImplRepo_Service.exe ../tao/bin/ImplRepo_Serviced.exe
copy tao/orbsvcs/ImplRepo_Service/Release/ImplRepo_Service.exe ../tao/bin
copy tao/orbsvcs/LifeCycle_Service/LifeCycle_Service.exe ../tao/bin/LifeCycle_Serviced.exe
copy tao/orbsvcs/LifeCycle_Service/Release/LifeCycle_Service.exe ../tao/bin
copy tao/orbsvcs/Naming_Service/Naming_Service.exe ../tao/bin/Naming_Serviced.exe
copy tao/orbsvcs/Naming_Service/NT_Naming_Service.exe ../tao/bin/NT_Naming_Serviced.exe
copy tao/orbsvcs/Naming_Service/Release/Naming_Service.exe ../tao/bin
copy tao/orbsvcs/Naming_Service/Release/NT_Naming_Service.exe ../tao/bin

copy tao/orbsvcs/Notify_Service/Notify_Service.exe ../tao/bin
copy tao/orbsvcs/Scheduling_Service/Scheduling_Service.exe ../tao/bin/Scheduling_Serviced.exe
copy tao/orbsvcs/Scheduling_Service/Release/Scheduling_Service.exe ../tao/bin
copy tao/orbsvcs/Trading_Service/Trading_Service.exe ../tao/bin/Trading_Serviced.exe
copy tao/orbsvcs/Trading_Service/Release/Trading_Service.exe ../tao/bin

@Create TAO SDK Finished!

来源:Mentoya. TAO使用指南. http://docs.huihoo.com/ace_tao/tao_guide.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: