Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6507394
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: LINUX

2015-09-24 11:34:34

[root@localhost lib]# uname -a
Linux localhost.localdomain 4.2.1-1.el7.elrepo.x86_64 #1 SMP Mon Sep 21 20:01:19 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost cBPM]# pwd
/opt/cBPM

++++++++++++++++++++++第1步:在CentOS7上安装Codelocks的过程。

1.安装gcc,需要c和c++两部分,默认安装下,CentOS不安装编译器的,在终端输入以下命令即可
yum install gcc
yum install gcc-c++

2.安装gtk2-devel,因为默认已经安装了正式产品需要的支持库,但是没有安装开发所需要的文档.
yum install gtk2*

3. 安装wxGTK(或者wxwidgets),下载地址:下载的文件为:wxWidgets-3.0.2.tar.bz2,

解压之后,进入目录后执行命令

./configure --enable-xrc --enable-monolithic --enable-unicode
make -j5
make install
 ------------------------------------------------------
 
 The installation of wxWidgets is finished.  On certain
 platforms (e.g. Linux) you'll now have to run ldconfig
 if you installed a shared library and also modify the
 LD_LIBRARY_PATH (or equivalent) environment variable.
 
 wxWidgets comes with no guarantees and doesn't claim
 to be suitable for any purpose.
 
 Read the wxWindows Licence on licencing conditions.
 
 ------------------------------------------------------

ldconfig


4. 安装codeblocks,下载codeblocks安装包,下载地址: />
这里有两种方式进行安装:

第一种方式是直接下载rpm包,可以直接进行安装,但是rpm安装形式,没有默认安装可视设计wxsmith。

第二种方式是下载源代码包,后缀为.tar.gz(.tar.bz2),下载之后,解压缩,进入目录,执行命令

./configure --prefix=/codeblocks --with-contrib-plugins=all
(如果只是./configure那默认情况是不会安装可视设计wssmith,如果不需要图形界面开发的话可以直接使用第一种安装方式)
-------------------------------------------------------------------------------
checking for GTK2... yes
checking for GAMIN... no
configure: error: Package requirements (gamin) were not met:

No package 'gamin' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GAMIN_CFLAGS
and GAMIN_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-------------------------------------------------------------------------------
解决上面问题的方法: yum install gamin*

make -j5
make install

[root@localhost bin]# pwd
/codeblocks/bin
[root@localhost bin]# ./codeblocks
./codeblocks: error while loading shared libraries: libwx_gtk2u-3.0.so.0: cannot open shared object file: No such file or directory
----------------------------------------
vim /etc/ld.so.conf
最后一行添加:/usr/local/lib
保存退出,然后运行 ldconfig 即可。
----------------------------------------


[root@localhost bin]# ln -s /codeblocks/bin/codeblocks /root/桌面/codeblocks


5.安装好codeblocks后,在application下会出现programming菜单项,在这里可以启动codeblocks.


6.安装一下xterm:yum install xterm

7.如果没有看到codeblocks菜单项,可以:创建桌面启动器如下:

 
1、点击应用程序--系统工具
2、选择“启动应用程序”
3、在启动用程序首选项中选择“添加”
4、会出现和以前一样的添加启动程序对话框,进行设置
5、设置完名称和命令(路径)后,点击“添加”,启动器就被添加到列表里了
6、用鼠标选中刚添加的启动器,将其拖到桌面
7、右击新建的起动器,选择属性,在权限选项卡中勾选——执行:允许以程序执行文件
8、同上步,在基本选项卡中点击图标,可以设置启动器的桌面图标。

++++++++++++++++++++++第2步:安装 xerces-c-3.1.2.tar.gz

[root@localhost xerces-c-3.1.2]# pwd
/opt/cBPM/xerces-c-3.1.2
[root@localhost xerces-c-3.1.2]# ./configure --prefix=/opt/cBPM/xerces-c
[root@localhost xerces-c-3.1.2]# make -j
[root@localhost xerces-c-3.1.2]# ll src/.libs/libxerces-c-3.1.so
-rwxr-xr-x. 1 root root 25155928 9月  24 09:11 src/.libs/libxerces-c-3.1.so
[root@localhost xerces-c-3.1.2]# cp src/.libs/libxerces-c-3.1.so /opt/cBPM/criteria-lin/lib/

++++++++++++++++++++++第3步: 设置codeblocks 参数

********---------------------------编译参数 设置********codeblocks 全局参数 设置:
【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Other options】
-Wunknown-pragmas

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【#defines】


【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Linker Settings】->【Link libraries】


【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Compiler】


【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Linker】


【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Toolchain executable】->【compiler Installation directory】
/usr
gcc
g++
g++
ar

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Build options】->【处理器数】4


********---------------------------********
codeblocks 局部参数 设置: Criteria.Libraries.bOS

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Compiler flags】
-g
-Wall

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Other options】
-W
-O0
-fPIC

默认情况下,GNU工具链编译过程中,控制台输出的一行信息是不换行的,这样,当输出信息过长时(如编译错误时的信息),会导致你无法看到完整的输出信息,加入-fmessage-length=0后,输出信息会根据控制台的宽度自动换行,这样就能看全输出信息了。

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【#defines】
SQLITE_OS_UNIX
WIN32
_DEBUG
_WINDOWS
_USRDLL
_USE_SQLITE3_
_CODEMANAGER_TRACE_ON_
BOS_EXPORTS
CODEMANAGER_EXPORTS

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Compiler】
/opt/cBPM/criteria-lin/include/bOS
/opt/cBPM/criteria-lin/include/
/usr/include

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Pre/post build steps】->【Post-build steps】
cp /opt/cBPM/criteria-lin/bin/Criteria/Debug/bOS/libLibraries.so /opt/cBPM/criteria-lin/lib


右健单击【Criteria.Libraries.bOS】,选择【Properties】,设置见图。





********---------------------------********
codeblocks 局部参数 设置: Criteria.WorkflowEngine

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Compiler flags】
-g
-Wall

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Other options】
-W
-O0
-fPIC

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【#defines】
WIN32
_DEBUG
_WINDOWS
_USRDLL
ENGINE_EXPORTS
WAPI_EXPORTS
_CODEMANAGER_TRACE_ON_
_USE_SQLITE3_
BOS_EXPORTS

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Compiler】
/opt/cBPM/criteria-lin/include/WorkflowEngine
/opt/cBPM/criteria-lin/include/bOS
/opt/cBPM/criteria-lin/include/
/usr/include

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Pre/post build steps】->【Post-build steps】
cp /opt/cBPM/criteria-lin/bin/Criteria/Debug/WorkflowEngine/libWorkflowEngineD.so /opt/cBPM/criteria-lin/lib

右健单击【Criteria.WorkflowEngine】,选择【Properties】,设置见图。





********---------------------------********
codeblocks 局部参数 设置: Criteria.Tools.Executor

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Compiler flags】
-g
-Wall

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【Other options】
-W
-O0

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Compiler Settings】->【#defines】
WIN32
_DEBUG
_CONSOLE
_CODEMANAGER_TRACE_ON_
BOS_EXPORTS
ENGINE_EXPORTS

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Linker Settings】->【link libraries】
Libraries
WorkflowEngineD
xerces-c-3.1
mysqlclient

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Compiler】
/opt/cBPM/criteria-lin/include/bOS
/opt/cBPM/criteria-lin/include/WorkflowEngine
/opt/cBPM/criteria-lin/include/
/usr/include

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Search directories】->【Linker】
/usr/lib64/mysql/
/opt/cBPM/criteria-lin/lib

【Settings】->【Compiler】->【GNU ARM GCC Compiler For Android】->【Pre/post build steps】->【Post-build steps】
cp /opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor/executer /opt/cBPM/criteria-lin/lib

右健单击【Criteria.Tools.Executor】,选择【Properties】,设置见图。








++++++++++++++++++++++第4步:编译成功

-------------- Build: Debug Win32 in Criteria.Tools.Executor (compiler: GNU GCC Compiler)---------------

g++ -L/usr/lib64/mysql/ -L/opt/cBPM/criteria-lin/lib -o /opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor/executer /opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor/src/main.o   -lLibraries -lWorkflowEngineD -lxerces-c-3.1 -lmysqlclient
Output file is /opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor/executer with size 47.44 KB
Running target post-build steps
cp /opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor/executer /opt/cBPM/criteria-lin/lib
Process terminated with status 0 (0 minute(s), 1 second(s))
43 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 
++++++++++++++++++++++第5步:在命令行测试

[root@localhost lib]# pwd
/opt/cBPM/criteria-lin/lib

[root@localhost lib]# ls
executer  libLibraries.so  libWorkflowEngineD.so  libxerces-c-3.1.so
[root@localhost lib]# ./executer
./executer: error while loading shared libraries: libLibraries.so: cannot open shared object file: No such file or directory

vim /etc/ld.so.conf
最后一行添加:/opt/cBPM/criteria-lin/lib
保存退出,然后运行 ldconfig 即可。

[root@localhost lib]# export WF_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor
[root@localhost lib]# export CRITERIA_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor
 
[root@localhost lib]# export WF_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor; export CRITERIA_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor

[root@localhost lib]# ./executer TestNotePadThe program will perform the following steps:

1: Criteria session initialization (only one time)
    ----- for each process (begin) -----
2: Create process instance from template
3: Execute process instance just created
    ----- for each process (end) -----
4: Querying for activity pending
5: close criteria session

Press a Key for beginning................................................
1
Criteria session Initialization.....(look at Executor trace file)
Criteria session Initialization [OK]
Create process instance from template
段错误(吐核)
[root@localhost lib]#


++++++++++++++++++++++第6步:在codeblocks测试  成功

 用codeblocks写程序,编译运行后发现codeblocks默认的终端居然是xterm,上网找了一下,发现这个办法能够让codeblocks调用系统终端:
启动codeblocks,点击菜单栏 Settings ==> Environment settings
把下面的“Terminal to launch console programs”的内容
xterm -T $TITLE -e
改成:
gnome-terminal --maximize -t $TITLE -x
就可以啦。

启动codeblocks,点击菜单栏 Settings ==> Environment settings ==> Environment variables
添加:
WF_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor
CRITERIA_HOME=/opt/cBPM/criteria-lin/bin/Criteria/Debug/Tools.Executor

单击 codeblocks 的 运行 按钮,成功




阅读(2030) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~