Linux C++开发笔记

20191007添加:
g++ -o svnpass svnpass.cpp
./svnpass hanxiaohua
rkxhskyrek
./svnpass -d rkxhskyrek
hanxiaohua
./svnpass -e hanxiaohua
rkxhskyrek

g++ -o chrasc chrasc.cpp
./chrasc
Usage: chrasc [-c][-a] arg2
./chrasc -c -12590
ϒ
./chrasc -c 119
w
./chrasc -c 169

./chrasc -c 98
b
./chrasc -c 25105
b
./chrasc -a 我
0
./chrasc -a w
119
./chrasc -c 52946
ϒ

g++ -o ComplexArg ComplexArg.cpp
./ComplexArg
Usage: ComplexArg [-t][-i][-v] arg2 arg3
./ComplexArg -v 1 1
17
./ComplexArg -i 1
0
./ComplexArg -t 1
1

g++ -o FileExists FileExists.cpp
./FileExists
Usage: FileExists arg1
./FileExists FileExists.cpp
FileExists.cpp文件存在
./FileExists FileExists.o
FileExists.o文件不存在

g++ -o WinRGBInfo WinRGBInfo.cpp
WinRGBInfo
Usage: WinRGBInfo [-a] color
WinRGBInfo -a 2810854
2810854=>D3DCOLOR_ARGB(0,42,227,230)
WinRGBInfo -a 0x2ae3e6
2810854=>D3DCOLOR_ARGB(0,42,227,230)
WinRGBInfo 16711680
16711680=>WinColor=16711680,R=0,G=0,B=255
WinRGBInfo 255
255=>WinColor=255,R=255,G=0,B=0
WinRGBInfo 16761798
16761798=>WinColor=16761798,R=198,G=195,B=255
gcc -o lookup lookup.c
./lookup
Usage: lookup classname
./lookup Bag
A collection class implemented by a hash table.
g++ -o itos itos.cpp
./itos
Usage: itos arg1
./itos 0
0=>灵智系
./itos 1
1=>蛮荒系
./itos 2
2=>地脉系
./itos 3
3=>天羽系
./itos 4
4=>蜚廉系
./itos 5
5=>瑞兽系
./itos 6
6=>神巫系
./itos 7
7=>幽冥系
./itos 8
8=>
./itos -1
-1=>


g++ -o NodeLayout NodeLayout.cpp
./NodeLayout
pn3=0x7ffe9a54eed0
pN3=0x7ffe9a54eed0

g++ -o geolinecircle geolinecircle.cpp
./geolinecircle
call from line::init()
now my (i am line) posx,posy are1010
call from circle::init()
now my (i am circle) posx,posy are2020
call from circle::init()
now my (i am circle) posx,posy are2020
call from circle::init()
now my (i am circle) posx,posy are2020
call from circle::init()
now my (i am circle) posx,posy are2020
call from circle::init()
now my (i am circle) posx,posy are2020


Unix/Linux程序例子1:如何使用fork
Linux下产生新的进程的系统调用就是fork函数,这个函数名是英文中“分叉”的意思。为什么取这个名字呢?因为一个进程在运行中,如果使用了fork,就产生了另一个进程,于是进程就“分叉”了,所以这个名字取得很形象。程序运行后,你就能看到屏幕上交替出现子进程与父进程各打印出的9条信息了。如果程序还在运行中,你用ps命令就能看到系统中有两个它在运行了。
g++ -o fork0 fork0.cpp
./fork0 &
[1] 4001
This is parent process
This is parent process
This is parent process
This is parent process
This is parent process
This is parent process
This is parent process
This is parent process
This is parent process


[1]+ Stopped ./fork0
ps -ef|grep fork0
root 4001 3966 0 13:13 pts/0 00:00:00 ./fork0
root 4002 4001 0 13:13 pts/0 00:00:00 ./fork0
root 4004 3966 0 13:13 pts/0 00:00:00 grep --color=auto fork0
jobs -l
[1]+ 4001 Stopped (tty input) ./fork0
fg #1
./fork0
This is child process
This is child process
This is child process
This is child process
This is child process
This is child process
This is child process
This is child process
This is child process

[root@instance-3h0vsi80 cpptest]# gcc -o getpid getpid.c
[root@instance-3h0vsi80 cpptest]# ./getpid
my pid is 16392
my parent's pid is 16025

20191110添加:
yum install zlib zlib-devel
gcc -o zlib0 zlib0.c -lz
[root@instance-3h0vsi80 cpptest]# find / -name libz.so
/usr/lib64/libz.so
[root@instance-3h0vsi80 cpptest]# find / -name libz.a
[root@instance-3h0vsi80 cpptest]# find / -name zlib.h
/usr/include/zlib.h
[root@instance-3h0vsi80 cpptest]# ./zlib0
hello my zlib test!
Src string:hello world!
 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试
Length:306

After Compressed Length:57
Compressed String:xʈΉȗ(ͯɉQ㑈$PH󿾥þdȚgԚm쾱~ª 
g

After UnCompressed Length:306
UnCompressed String:hello world!
 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试 aaaaa bbbbb ccccc ddddd aaaaa bbbbb ccccc ddddd中文测试 中文测试
[root@instance-3h0vsi80 cpptest]# 

20190202添加:
wget https://github.com/git/git/archive/v2.14.1.zip
su
sudo yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
unzip v2.14.1.zip
[root@localhost hxh]# cd git-2.14.1
[root@localhost git-2.14.1]# git --version
git version 1.8.3.1
[root@localhost git-2.14.1]# git clone https://Ivanhan2018@github.com/Ivanhan2018/zsbbserver.git
[root@localhost git-2.14.1]# exit
exit
[hxh@localhost ~]$ ls
Desktop    Downloads   Music     Public     v2.14.1.zip
Documents  git-2.14.1  Pictures  Templates  Videos
[hxh@localhost ~]$ git clone https://Ivanhan2018@github.com/Ivanhan2018/zsbbserver.git
[hxh@localhost ~]$ pwd
/home/hxh

yum install boost
yum install boost-devel
yum install boost-doc
[root@localhost linux]# yum install gcc-c++

[hxh@localhost linux]$ g++ posix_main.cpp -o posix_main -lboost_system -lboost_filesystem
[hxh@localhost linux]$ ./posix_main
hello,world

查看boost版本号
[hxh@localhost zsbbserver]$ su
Password:
[root@localhost zsbbserver]# find / -name libboost_random.so*
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/lib64/libboost_random.so.1.53.0
/usr/lib64/libboost_random.so
[root@localhost zsbbserver]# vim /usr/include/boost/version.hpp

vs2005服务器工程文件*.vcproj
-1_40.替换为-1_35.,boostlib替换为lib
例如
libboost_filesystem-vc80-mt-gd-1_40.lib替换为libboost_filesystem-vc80-mt-gd-1_35.lib
新建环境变量
BOOST_ROOT
E:\boost_1_35_0

E:\>cd E:\boost_1_35_0\tools\jam\src

E:\boost_1_35_0\tools\jam\src>build.bat
此时不应有 \Microsoft。

e:\boost_1_35_0>bjam --without-python --toolset=msvc-8.0 --build-type=complete --prefix="e:/boost_1_35_0" stage
e:\boost_1_35_0>bjam --without-python --toolset=msvc-8.0 --build-type=complete --prefix="e:/boost_1_35_0" install

20190108添加:
GitHub上为自己的仓库添加协作者
进入该仓库,依次点击Setting->Collaborator,输入协作者用户名,点击Add collaborator即可
Successfully invited Ivanhan2018.
邀请成功以后,需要被邀请人去自己的邮箱点击一下,确认邀请
You now have push access to the hanshouqing85/Project3.x repository.
被邀请者Ivanhan2018:
[root@localhost hxh]# cd /home/hxh/work1
[root@localhost work1]# git clone https://github.com/hanshouqing85/Project3.x.git
[root@localhost work1]# cd Project3.x
[root@localhost Project3.x]# git add .
[root@localhost Project3.x]# git commit -m "Ivanhan2018提交"
[root@localhost Project3.x]# git push origin master

[root@localhost ~]# cd /home/hxh/GameServer
[root@localhost GameServer]# mv lib1 ../lib1
[root@localhost GameServer]# mv log ../log

CentOS 64位系统编译32位C++程序:
[root@localhost src]# yum -y install glibc-devel.i686
[root@localhost src]# yum install libgcc.i686
[root@localhost src]# yum whatprovides libstdc++.so.6
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cqu.edu.cn
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
libstdc++-4.8.5-36.el7.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Provides    : libstdc++.so.6
 
[root@localhost src]# yum install libstdc++-4.8.5-36.el7.i686

[root@localhost src]# cp /home/hxh/GameServer/lib/libreactor.* /usr/lib/
[root@localhost src]# ./MahjongServer
[root@localhost src]# ./start.sh

编译c++11程序:
root@ubuntu:/home/hanxiaohua# g++ -std=c++11 -o test test.cpp
root@ubuntu:/home/hanxiaohua# ./test
5
root@ubuntu:/home/hanxiaohua# strings /usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.so | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

CentOS 6.6通过yum从4.4.7升级gcc/g++至版本4.8.2(最简易方式)
https://blog.csdn.net/dijkstar/article/details/82218170

第一个Linux C++程序
https://github.com/Ivanhan2018/MathTool.git
 g++ -fPIC -shared -o libdcomplex.so dcomplex.cpp
 ls
calccomplex.cpp  dcomplex.cpp  dcomplex.h  libdcomplex.so
 g++ -o calccomplex calccomplex.cpp -L. -ldcomplex -ldl
 ls
calccomplex  calccomplex.cpp  dcomplex.cpp  dcomplex.h  libdcomplex.so
 ./calccomplex ./libdcomplex.so CSin 1 2.1
CSin(1.000000,2.100000)=(3.487319,2.173018)
 ./calccomplex ./libdcomplex.so CCos 1 2.1
CCos(1.000000,2.100000)=(2.239182,-3.384276)
 ./calccomplex ./libdcomplex.so CLn 3 2
CLn(3.000000,2.000000)=(1.282475,0.588003)
 ./calccomplex ./libdcomplex.so CExp 1 2.1
CExp(1.000000,2.100000)=(-1.372314,2.346446)
 ./calccomplex ./libdcomplex.so CTan 1 2.1
CTan(1.000000,2.100000)=(0.027609,1.012180)
 ./calccomplex ./libdcomplex.so J 4.31303 1.0
J(4.313030,1.000000)=(0.201483,-0.121554)
 g++ -o calccomplex2 calccomplex2.cpp -L. -ldcomplex -ldl
 ./calccomplex2 ./libdcomplex.so CMul 9 11 56 3
CMul((9.000000,11.000000),(56.000000,3.000000))=(471.000000,643.000000)
 ./calccomplex2 ./libdcomplex.so CDiv 471 643 9 11
CDiv((471.000000,643.000000),(9.000000,11.000000))=(56.000000,3.000000)
 ./calccomplex2 ./libdcomplex.so KleinInvariantJ 1 2 1 2
KleinInvariantJ((1.000000,2.000000),(1.000000,2.000000))=(166.375000,-0.000000)
 ./calccomplex2 ./libdcomplex.so CDiv 7.416195 0 8.626062 0
CDiv((7.416195,0.000000),(8.626062,0.000000))=(0.859743,0.000000)
 ./calccomplex2 ./libdcomplex.so g2 0 0.859743 8.626062 0
g2((0.000000,0.859743),(8.626062,0.000000))=(0.049881,0.000000)
 ./calccomplex2 ./libdcomplex.so g3 0 0.859743 8.626062 0
g3((0.000000,0.859743),(8.626062,0.000000))=(-0.001121,0.000000)
 ./calccomplex2 ./libdcomplex.so g2 0 0.859743 1 0
g2((0.000000,0.859743),(1.000000,0.000000))=(276.175781,0.000000)
 ./calccomplex2 ./libdcomplex.so g3 0 0.859743 1 0
g3((0.000000,0.859743),(1.000000,0.000000))=(-461.879653,0.000000)
 ./calccomplex2 ./libdcomplex.so sn 0.5 0 0.866025 0
sn((0.500000,0.000000),(0.866025,0.000000))=(0.466428,0.000000)
 ./calccomplex2 ./libdcomplex.so sn 1 2 0 0
sn((1.000000,2.000000),(0.000000,0.000000))=(3.165779,1.959601)
 ./calccomplex2 ./libdcomplex.so theta_00 0 0 0 1
theta_00((0.000000,0.000000),(0.000000,1.000000))=(1.086435,0.000000)
 ./calccomplex2 ./libdcomplex.so theta_00 0.2 0 0 0.5
theta_00((0.200000,0.000000),(0.000000,0.500000))=(1.125454,0.000000)
 g++ -o rundll rundll.cpp -L. -lmathlib -ldl
 ./rundll ./libmathlib.so lgam1 0.5
lgam1(0.500000)=1.772454
 ./rundll ./libmathlib.so lexpp 0
lexpp(0.000000)=-22.448635
 ./rundll ./libmathlib.so lcoss 0
lcoss(0.000000)=-80.013263
 ./rundll ./libmathlib.so lsinn 1
lsinn(1.000000)=0.946083
编译生成共享库:
 g++ -fPIC -shared -o libmathlib.so mathlib.cpp
 ls
libmathlib.so  mathlib0.cpp  mathlib.cpp  mathlib.h
 g++ -o mathlib0 mathlib0.cpp -L. -lmathlib
 ls
libmathlib.so  mathlib0  mathlib0.cpp  mathlib.cpp  mathlib.h
 ./mathlib0
./mathlib0: error while loading shared libraries: libmathlib.so: cannot open shared object file: No such file or directory
 LD_LIBRARY_PATH=. ./mathlib0
 1.000000 6.000000 16.000000 26.000000 31.000000 20.000000
extern "C" void conv(float *xin, float *h, int lx, int lh,float *xout);//线性卷积
extern "C"要加上,否则pconv g_Test = (pconv)dlsym(handle, "conv");char* szError = dlerror();就会报错:
ERROR, Message(/home/hanxiaohua/mathlib/libmathlib.so: undefined symbol: conv).
 g++ -fPIC -shared -o libmathlib.so mathlib.cpp
 g++ -o mathlib0 mathlib0.cpp -L. -lmathlib -ldl
 ./mathlib0
 1.000000 6.000000 16.000000 26.000000 31.000000 20.000000
//#include "mathlib.h"
#include <stdio.h>
#include <dlfcn.h>
//定义函数接口
typedef void (*pconv)(float *xin, float *h, int lx, int lh,float *xout);//线性卷积
int main()
{
float a[4],b[3],xout[6];
a[0]=1;a[1]=2;a[2]=3;a[3]=4;
b[0]=1;b[1]=4;b[2]=5;
//动态加载so
#if 1
    void* handle = dlopen("./libmathlib.so", RTLD_LAZY);
    if(!handle)
    {
            printf("ERROR, Message(%s).\n", dlerror());
            return -1;
    }
    pconv g_Test = (pconv)dlsym(handle, "conv");
    char* szError = dlerror();
    if(szError != NULL)
    {
        printf("ERROR, Message(%s).\n", szError);
        dlclose(handle);
        return -1;
    }
    if(g_Test != NULL)
    {
        g_Test(a,b,4,3,xout);
    }
    dlclose(handle);
    g_Test = NULL;
    //return 0;
#else
conv(a,b,4,3,xout);
#endif
for (int i = 0; i <6; i++)
printf(" %f",xout[i]);
return 0;
}
root@ubuntu:/home/hanxiaohua# vim cpp1.cpp
root@ubuntu:/home/hanxiaohua# g++ -o cpp1 cpp1.cpp
root@ubuntu:/home/hanxiaohua# ./cpp1
1
4
6
3
2
the_vector= 1 4 6 3 2
root@ubuntu:/home/hanxiaohua# g++ -o union union.cpp
root@ubuntu:/home/hanxiaohua# ./union
3321997504=192,168,1,198
16777343=127,0,0,1
1879156928=192,168,1,112
92309053=61,134,128,5
源文件要保存为utf-8编码,否则Linux下的中文显示为乱码
root@ubuntu:/home/hanxiaohua# g++ -o MDet MDet.cpp
root@ubuntu:/home/hanxiaohua# ./MDet "1,0,2;0,2,0;0,0,3"
矩阵行列式的值为:6
conv卷积
root@ubuntu:/home/hanxiaohua/conv# g++ -c conv.cpp conv0.cpp
root@ubuntu:/home/hanxiaohua/conv# ls
conv0.cpp  conv0.o  conv.cpp  conv.h  conv.o
root@ubuntu:/home/hanxiaohua/conv# g++ -o conv conv.o conv0.o
root@ubuntu:/home/hanxiaohua/conv# ls
conv  conv0.cpp  conv0.o  conv.cpp  conv.h  conv.o
root@ubuntu:/home/hanxiaohua/conv# ./conv
1.000000 6.000000 16.000000 26.000000 31.000000 20.000000
root@ubuntu:/home/hanxiaohua/conv#
 g++ -o lgam10 lgam10.cpp -L. -lmathlib -ldl
 ./lgam10
exit with pressing e:1
计算实伽马函数Γ(x),请输入x:
0.5
Γ(x=0.500000)=1.772454
exit with pressing e:计算实伽马函数Γ(x),请输入x:
1
Γ(x=1.000000)=1.000010
exit with pressing e:计算实伽马函数Γ(x),请输入x:
2
Γ(x=2.000000)=1.000010
exit with pressing e:计算实伽马函数Γ(x),请输入x:
3
Γ(x=3.000000)=2.000020
exit with pressing e:计算实伽马函数Γ(x),请输入x:
e
Γ(x=3.000000)=2.000020
exit with pressing e:
20181124添加:
 g++ -o FGMtx FGMtx.cpp GroupUtil.cpp
 ./FGMtx "SL;2;3;0,1,2,0;0,1,2,1" "SL(2,3)"
计算矩阵群SL(2,3)的凯莱表完毕!
 ./FGMtx "SL;2;3;0,1,2,0;0,1,2,1" G24_3
计算矩阵群G24_3的凯莱表完毕!
 ./FGMtx "GL;2;3;0,1,2,0;0,1,2,1;2,2,0,1"
计算矩阵群GL(2,3)_48的凯莱表完毕!
 ./FGMtx "GL;2;3;0,1,2,0;0,1,2,1;2,2,0,1" "GL(2,3)"
计算矩阵群GL(2,3)的凯莱表完毕!
 ./FGMtx "O;2;3;0,1,1,0;0,2,1,0" D4
R4_9、R4_10、R4_11的有限域上多项式环的商环表示
 g++ -o GRpf GRpf.cpp PolyUtil.cpp
 ./GRpf 2 x^2+x^1+x^0 F4.txt
 ./GRpf 2 x^2+x^0
f=1x^2 1x^0 =1x^2 0x^1 1x^0 =5是可约多项式
[R4Add]
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
[R4Mul]
1 1 1 1
1 2 3 4
1 3 2 4
1 4 4 1
 ./calR GR4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=2
G4ElementToOrder(2)=2
G4ElementToOrder(3)=2
GR4有1个1阶元,3个2阶元,0个4阶元
环的结构不变量n0,bA,bO,n1,n2,n4,n5,n6,n7=2,1,1,2,2,1,1,8,1
交换,幺环,不可逆元个数n1=2,幂等元个数n2=2,2次幂零元个数n4=1,2~3次幂零元个数n5=1,零乘个数n6=8,零因子个数n7=1,
分析环的结构完毕!
 ./GRpf 2 "x^2+x^1"
f=1x^2 1x^1 =1x^2 1x^1 0x^0 =6是可约多项式
[R4Add]
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
[R4Mul]
1 1 1 1
1 2 3 4
1 3 3 1
1 4 1 4
 ./calR GR4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=2
G4ElementToOrder(2)=2
G4ElementToOrder(3)=2
GR4有1个1阶元,3个2阶元,0个4阶元
环的结构不变量n0,bA,bO,n1,n2,n4,n5,n6,n7=2,1,1,3,4,0,0,9,2
交换,幺环,不可逆元个数n1=3,幂等元个数n2=4,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=9,零因子个数n7=2,
分析环的结构完毕!
 ./GRpf 2 x^2+x^1+x^0
f=1x^2 1x^1 1x^0 =1x^2 1x^1 1x^0 =7是不可约多项式
[R4Add]
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
[R4Mul]
1 1 1 1
1 2 3 4
1 3 4 2
1 4 2 3
 ./calR GR4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=2
G4ElementToOrder(2)=2
G4ElementToOrder(3)=2
GR4有1个1阶元,3个2阶元,0个4阶元
环的结构不变量n0,bA,bO,n1,n2,n4,n5,n6,n7=2,1,1,1,2,0,0,7,0
交换,幺环,不可逆元个数n1=1,幂等元个数n2=2,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=7,零因子个数n7=0,
分析环的结构完毕!
 g++ -o DPZMF DPZMF.cpp RingUtil.cpp
 ./DPZMF Z2,Z2,M2
 g++ -o AbelianGroup AbelianGroup.cpp GroupUtil.cpp
 ./AbelianGroup 2,2,2
 g++ -o SmallRing SmallRing.cpp Rn.cpp RingUtil.cpp
 g++ -o IdRing IdRing.cpp RingUtil.cpp
 ./IdRing 4,1,0,4,1,3,3,16,3
IdRing(4,1,0,4,1,3,3,16,3)=[4,1],name=M_4
特征n0=4,交换,无幺环,不可逆元个数n1=4,幂等元个数n2=1,2次幂零元个数n4=3,2~3次幂零元个数n5=3,零乘个数n6=16,零因子个数n7=3,
 ./IdRing
请输入环的结构不变量calR=n0,bA,bO,n1,n2,n4,n5,n6,n7:4,1,0,4,1,1,3,12,3
IdRing(4,1,0,4,1,1,3,12,3)=[4,2],name=R4_2
特征n0=4,交换,无幺环,不可逆元个数n1=4,幂等元个数n2=1,2次幂零元个数n4=1,2~3次幂零元个数n5=3,零乘个数n6=12,零因子个数n7=3,
 ./GFp 2 2
ii=0
1 1 1
1x^2 1x^1 1x^0
f=1x^2 1x^1 1x^0 =1x^2 1x^1 1x^0 =7
[F4Add]
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
[F4Mul]
1 1 1 1
1 2 3 4
1 3 4 2
1 4 2 3
 ./calR F4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=2
G4ElementToOrder(2)=2
G4ElementToOrder(3)=2
F4有1个1阶元,3个2阶元,0个4阶元
环的结构不变量n0,bA,bO,n1,n2,n4,n5,n6,n7=2,1,1,1,2,0,0,7,0
交换,幺环,不可逆元个数n1=1,幂等元个数n2=2,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=7,零因子个数n7=0,
分析环的结构完毕!
 g++ -o SmallRing SmallRing.cpp RingUtil.cpp
 ./SmallRing 4 1
 ./SmallRing 4 2
 ./SmallRing 4 3
 ./SmallRing 4 4
 ./SmallRing 4 7
 ./SmallRing 4 8
 ./SmallRing 4 10
 ./SmallRing 4 6
 g++ -o SmallGroup SmallGroup.cpp GroupUtil.cpp
 ./SmallGroup 6 1
GAP4[6,1].txt生成完毕!
 ./SmallGroup 6 2
GAP4[6,2].txt生成完毕!
 ./calG GAP4[6,1].txt
GAP4[6,1].txt
GAP4[6,1]
G6ElementToOrder(0)=1
G6ElementToOrder(1)=2
G6ElementToOrder(2)=2
G6ElementToOrder(3)=2
G6ElementToOrder(4)=3
G6ElementToOrder(5)=3
GAP4[6,1]有1个1阶元,3个2阶元,2个3阶元,0个6阶元
分析群的结构完毕!
 ./calG GAP4[6,2].txt
GAP4[6,2].txt
GAP4[6,2]
G6ElementToOrder(0)=1
G6ElementToOrder(1)=6
G6ElementToOrder(2)=3
G6ElementToOrder(3)=2
G6ElementToOrder(4)=3
G6ElementToOrder(5)=6
GAP4[6,2]有1个1阶元,1个2阶元,2个3阶元,2个6阶元
分析群的结构完毕!
 g++ -o IdGroup IdGroup.cpp
 ./IdGroup 1,1,2,2,2,4
IdGroup(1,1,2,2,2,4)=[12,2],name=C_12
 ./IdGroup "1,1,2,2,2,4"
IdGroup(1,1,2,2,2,4)=[12,2],name=C_12
 ./IdGroup
请输入群元阶的分布calG:1,1,2,2,2,4
IdGroup(1,1,2,2,2,4)=[12,2],name=C_12
 ./IdGroup 1,5,2,0
IdGroup(1,5,2,0)=[8,3],name=D_4
 ./IdGroup 1,1,2,2,2,12,4,0
IdGroup(1,1,2,2,2,12,4,0)=[24,1],name=C_3和C_8的非平凡半直积
 ./IdGroup 1,7,8,0,0
IdGroup(1,7,8,0,0)有3个群:
IdGroup(1,7,8,0,0)=[16,3],name=(C_4×C_2):C_2,秩为2
IdGroup(1,7,8,0,0)=[16,10],name=C_4×C_2×C_2
IdGroup(1,7,8,0,0)=[16,13],name=(C_4×C_2):C_2,秩为3
 g++ -o dpoly0 dpoly0.cpp dpoly.cpp
 ./dpoly0
The polynomial is:
0  +1 x^1 +2.5 x^2
The polynomial is:
3  +1 x^1
The polynomial is:
0  +3 x^1 +8.5 x^2 +2.5 x^3
 g++ -o PolyUtil0 PolyUtil.cpp PolyUtil0.cpp
 ./PolyUtil0
a=7x^4 1x^2
b=6x^3 -3x^2
c=a-b=7x^4 -6x^3 4x^2
c=a*b=42x^7 -21x^6 6x^5 -3x^4
d=c''=1764x^5 -630x^4 120x^3 -36x^2
c(2)=4176
 g++ -o PolyUtil0 PolyUtil.cpp PolyUtil0.cpp
 ./PolyUtil0
(1,0)
第1个4次单位根=(1,0),模=1,4次幂=(1,0)
第2个4次单位根=(2.67949e-08,1),模=1,4次幂=(1,-1.0718e-07)
第3个4次单位根=(-1,5.35898e-08),模=1,4次幂=(1,-2.14359e-07)
第4个4次单位根=(-8.03847e-08,-1),模=1,4次幂=(1,-3.21539e-07)
3次分圆多项式=1x^2 1x^1 1x^0
4次分圆多项式=1x^2 1x^0
5次分圆多项式=1x^4 1x^3 1x^2 1x^1 1x^0
c1=a*b=2x^3 7x^2 3x^1
a=2x^2 1x^1
b=1x^1 3x^0
c=a-b=2x^2 -3x^0
c=a*b=2x^3 7x^2 3x^1
d=c''=12x^1 14x^0
c(2)=50
polys[0]=4x^3 3x^2 2x^1 1x^0
polys[1]=1x^2 2x^1 1x^0
polys[2]=4x^1 -5x^0
polys[3]=8x^1 6x^0
polys[4]=4x^3 3x^2 2x^1 1x^0
q=4x^1 -5x^0
r=8x^1 6x^0
 g++ -o polyInF20 polyInF2.cpp polyInF20.cpp
 ./polyInF20
 g++ -o GF GaloisField.cpp GaloisFieldElement.cpp GaloisFieldPolynomial.cpp GF.cpp
 ./GF 2
ii=0
1 1 1
[F4Add]
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
[F4Mul]
1 1 1 1
1 2 3 4
1 3 4 2
1 4 2 3
 vim F4.txt
 g++ -o GF2 polyInF2.cpp GF2.cpp
 ./GF2 3
ii=0
1 1 0 1
ii=1
1 0 1 1
ii=2
0 1 1 1
f=x^3+x^2+1=1101=13是本原多项式
[F8Add]
1 2 3 4 5 6 7 8
2 1 4 3 6 5 8 7
3 4 1 2 7 8 5 6
4 3 2 1 8 7 6 5
5 6 7 8 1 2 3 4
6 5 8 7 2 1 4 3
7 8 5 6 3 4 1 2
8 7 6 5 4 3 2 1
[F8Mul]
1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8
1 3 5 7 6 8 2 4
1 4 7 6 2 3 8 5
1 5 6 2 8 4 3 7
1 6 8 3 4 7 5 2
1 7 2 8 3 5 4 6
1 8 4 5 7 2 6 3
 ../gaptool/calR ./F8.txt
G8ElementToOrder(0)=1
G8ElementToOrder(1)=2
G8ElementToOrder(2)=2
G8ElementToOrder(3)=2
G8ElementToOrder(4)=2
G8ElementToOrder(5)=2
G8ElementToOrder(6)=2
G8ElementToOrder(7)=2
F8有1个1阶元,7个2阶元,0个4阶元,0个8阶元
交换,幺环,幂等元个数n2=2,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=15,零因子个数n7=0,
分析环的结构完毕!
GF2和GF生成的结果不一样,但都是F_8:
[F8Add]
1 2 3 4 5 6 7 8
2 1 4 3 6 5 8 7
3 4 1 2 7 8 5 6
4 3 2 1 8 7 6 5
5 6 7 8 1 2 3 4
6 5 8 7 2 1 4 3
7 8 5 6 3 4 1 2
8 7 6 5 4 3 2 1
[F8Mul]
1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8
1 3 5 7 4 2 8 6
1 4 7 6 8 5 2 3
1 5 4 8 7 3 6 2
1 6 2 5 3 8 4 7
1 7 8 2 6 4 3 5
1 8 6 3 2 7 5 4
 ./DPR ./Z2.txt ./Z3.txt ./Z2Z3.txt
[R6Add]
1 2 3 4 5 6
2 3 1 5 6 4
3 1 2 6 4 5
4 5 6 1 2 3
5 6 4 2 3 1
6 4 5 3 1 2
[R6Mul]
1 1 1 1 1 1
1 2 3 1 2 3
1 3 2 1 3 2
1 1 1 4 4 4
1 2 3 4 5 6
1 3 2 4 6 5
计算直积环的凯莱表完毕!
 vim Z2Z3.txt
 ./calR ./Z2Z3.txt
G6ElementToOrder(0)=1
G6ElementToOrder(1)=3
G6ElementToOrder(2)=3
G6ElementToOrder(3)=2
G6ElementToOrder(4)=6
G6ElementToOrder(5)=6
Z2Z3有1个1阶元,1个2阶元,2个3阶元,2个6阶元
交换,幺环,幂等元个数n2=4,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=15,零因子个数n7=3,
分析环的结构完毕!
 ./calR ./Z6.txt
G6ElementToOrder(0)=1
G6ElementToOrder(1)=6
G6ElementToOrder(2)=3
G6ElementToOrder(3)=2
G6ElementToOrder(4)=3
G6ElementToOrder(5)=6
Z6有1个1阶元,1个2阶元,2个3阶元,2个6阶元
交换,幺环,幂等元个数n2=4,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=15,零因子个数n7=3,
分析环的结构完毕!
 g++ -o calR calR.cpp
 ./calR ./F4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=2
G4ElementToOrder(2)=2
G4ElementToOrder(3)=2
F4有1个1阶元,3个2阶元,0个4阶元
交换,幺环,幂等元个数n2=2,2次幂零元个数n4=0,2~3次幂零元个数n5=0,零乘个数n6=7,零因子个数n7=0,
分析环的结构完毕!
 vim F4_ElementToOrder.txt
 g++ -o Zn Zn.cpp
 ./Zn 4
[R4Add]
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
[R4Mul]
1 1 1 1
1 2 3 4
1 3 1 3
1 4 3 2
 vim Z4.txt
 ./calR ./Z4.txt
G4ElementToOrder(0)=1
G4ElementToOrder(1)=4
G4ElementToOrder(2)=2
G4ElementToOrder(3)=4
Z4有1个1阶元,1个2阶元,2个4阶元
交换,幺环,幂等元个数n2=2,2次幂零元个数n4=1,2~3次幂零元个数n5=1,零乘个数n6=8,零因子个数n7=1,
分析环的结构完毕!
 vim Z4_ElementToOrder.txt
 g++ -o Mn Mn.cpp
 ./Mn 4
[M4Add]
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
[M4Mul]
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
 vim "M4.txt"
 g++ -o Cn Cn.cpp
 ./Cn 4
 ls
C4.txt  Cn  Cn.cpp
 vim C4.txt
 g++ -o calG calG.cpp
 ./calG ./C4.txt
C4.txt
C4
G4ElementToOrder(0)=1
G4ElementToOrder(1)=4
G4ElementToOrder(2)=2
G4ElementToOrder(3)=4
C4有1个1阶元,1个2阶元,2个4阶元
分析群的结构完毕!
 vim C4_ElementToOrder.txt
 g++ -o DP DP.cpp
 ./DP ./C4.txt ./C4.txt ./C4C4.txt
计算直积群的凯莱表完毕!
 vim C4C4.txt
 g++ -o FG FG.cpp
 ./FG
请输入有限生成置换群A的生成元文件名:./S5.txt
120阶群的凯莱表生成完毕!
 vim S5.txt.txt
 g++ -o SnMul SnMul.cpp
 ./SnMul 5 "2,3,1,4,5" "1,3,2,5,4"
置换m*n:3,1,2,4,5
请输入置换次数N:3
请输入置换m:1,3,2
请输入置换n:2,3,1
置换m*n:2,1,3
 g++ -o UnMulTable UnMulTable.cpp
 ./UnMulTable 8
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
 ./UnMulTable
请输入正整数n:15
1 2 3 4 5 6 7 8
2 3 5 8 1 4 6 7
3 5 1 7 2 8 4 6
4 8 7 3 6 2 1 5
5 1 2 6 3 7 8 4
6 4 8 2 7 1 5 3
7 6 4 1 8 5 3 2
8 7 6 5 4 3 2 1
 g++ -o ZDOfG ZDOfG.cpp
 ./ZDOfG ./D3C2.txt
中心:
0
1
|Z(D3C2)|=2
换位子群:
0
6
8
|(D3C2)'|=3
子群形式的中心凯莱表ZTableOfG:
1 2
2 1
子群形式的换位子群凯莱表DTableOfG:
1 7 9
7 9 1
9 1 7
规范形式的中心凯莱表ZTableOfG_N:
1 2
2 1
规范形式的换位子群凯莱表DTableOfG_N:
1 2 3
2 3 1
3 1 2
计算群的中心、换位子群完毕!
射影中心PZTableOfG:
1 2 3 4 5 6
2 1 4 3 6 5
3 5 1 6 2 4
4 6 2 5 1 3
5 3 6 1 4 2
6 4 5 2 3 1
射影换位子群PDTableOfG:
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
计算群的射影中心、射影换位子群完毕!
 vim "ZD(D3C2).txt"
 g++ -o pibub0 pibub0.cpp -L. -lmathlib -ldl
 ./pibub0 ./libmathlib.so pibub "5,3,7,9,4"
pibub(5,3,7,9,4)=3,4,5,7,9
 ./pibub0 ./libmathlib.so piqck "5,3,7,9,4"
piqck(5,3,7,9,4)=3,4,5,7,9
 ./pibub0 ./libmathlib.so pishl "5,3,7,9,4"
pishl(5,3,7,9,4)=3,4,5,7,9
 ./pibub0 ./libmathlib.so pihap "5,3,7,9,4"
pihap(5,3,7,9,4)=3,4,5,7,9
 ./pibub0 ./libmathlib.so mysort1 "5,3,7,9,4" 1
A[i=0]=53794
A[i=1]=35794
A[i=2]=35794
A[i=3]=35794
A[i=4]=34579
mysort1(5,3,7,9,4,1)=3,4,5,7,9
 ./pibub0 ./libmathlib.so mysort1 "5,3,7,9,4" 0
mysort1(5,3,7,9,4,0)=9,7,5,4,3
 ./pibub0 ./libmathlib.so reversed "5,3,7,9,4,6"
reversed(5,3,7,9,4,6)=6,4,9,7,3,5
 ./pibub0 ./libmathlib.so reversed "5,3,7,9,4"
reversed(5,3,7,9,4)=4,9,7,3,5
 g++ -fPIC -shared -o libmathlib.so mathlib.cpp
 ./pibub0 ./libmathlib.so mysort2 "5,3,7,9,4" 1
A[i=0]=35794
A[i=1]=35794
A[i=2]=35794
A[i=3]=35749
A[i=3]=35479
A[i=2]=34579
A[i=1]=34579
A[i=2]=34579
mysort2(5,3,7,9,4,1)=3,4,5,7,9
 ./pibub0 ./libmathlib.so mysort2 "5,3,7,9,4" 0
A[i=0]=35794
A[i=1]=35794
A[i=2]=35794
A[i=3]=35749
A[i=3]=35479
A[i=2]=34579
A[i=1]=34579
A[i=2]=34579
mysort2(5,3,7,9,4,0)=9,7,5,4,3
 g++ -fPIC -shared -o libsmallint.so smallint.cpp
 g++ -o rungcd rungcd.cpp -L. -lsmallint -ldl
 ./rungcd ./libsmallint.so gcd 12 32
gcd(12,32)=4
 ./rungcd ./libsmallint.so gcd 12 -32
gcd(12,-32)=-4
 ./rungcd ./libsmallint.so gcd -12 32
gcd(-12,32)=-4
 ./rungcd ./libsmallint.so apailie 5 3
apailie(5,3)=60
 ./rungcd ./libsmallint.so apailie 5 2
apailie(5,2)=20
 ./rungcd ./libsmallint.so czuhe 5 3
czuhe(5,3)=10
 ./rungcd ./libsmallint.so czuhe 5 2
czuhe(5,2)=10
 ./rungcd ./libsmallint.so jacobi 40904 84143
jacobi(40904,84143)=-1
 ./rungcd ./libsmallint.so jacobi 7 5
jacobi(7,5)=-1
 ./rungcd ./libsmallint.so Jacobi 40904 84143
Jacobi(40904,84143)=-1
 ./rungcd ./libsmallint.so Jacobi 7 5
Jacobi(7,5)=-1
 ./rungcd ./libsmallint.so DivisorSigma 0 20
DivisorSigma(0,20)=6
 ./rungcd ./libsmallint.so DivisorSigma 1 20
DivisorSigma(1,20)=42
 ./rungcd ./libsmallint.so DivisorSigma 2 20
DivisorSigma(2,20)=546
 ./rungcd ./libsmallint.so Sigma 0 20
Sigma(0,20)=6
 ./rungcd ./libsmallint.so Sigma 1 20
Sigma(1,20)=42
 ./rungcd ./libsmallint.so Sigma 2 20
Sigma(2,20)=546
 g++ -o runeulerphi runeulerphi.cpp -L. -lsmallint -ldl
 ./runeulerphi ./libsmallint.so Sigma0 20
Sigma0(20)=6
 ./runeulerphi ./libsmallint.so Sigma0 140
Sigma0(140)=12
 ./runeulerphi ./libsmallint.so Sigmad 20
Sigmad(20)=42
 ./runeulerphi ./libsmallint.so Sigmad 140
Sigmad(140)=336
 ./runeulerphi ./libsmallint.so euler 50
euler(50)=20
 ./runeulerphi ./libsmallint.so minprimroot 8
minprimroot(8)=0
 ./runeulerphi ./libsmallint.so minprimroot 7
minprimroot(7)=3
 ./runeulerphi ./libsmallint.so minprimroot 11
minprimroot(11)=2
 ./runeulerphi ./libsmallint.so minprimroot 50
minprimroot(50)=3
 ./runeulerphi ./libsmallint.so GetMaxPrime 20
GetMaxPrime(20)=19
 ./runeulerphi ./libsmallint.so GetMaxPrime 50
GetMaxPrime(50)=47
 ./runeulerphi ./libsmallint.so GetMaxPrime 200
GetMaxPrime(200)=199
 ./runeulerphi ./libsmallint.so GetMaxPrime 500
GetMaxPrime(500)=499
 ./rungcd ./libsmallint.so is_primitive_root 3 7
is_primitive_root(3,7)=1
 ./rungcd ./libsmallint.so is_primitive_root 5 7
is_primitive_root(5,7)=1
 ./rungcd ./libsmallint.so orderm 3 8
orderm(3,8)=2
 ./rungcd ./libsmallint.so orderm 3 50
orderm(3,50)=20
 ./rungcd ./libsmallint.so orderm 3 7
orderm(3,7)=6
 ./rungcd ./libsmallint.so orderm 5 7
orderm(5,7)=6
 ./rungcd ./libsmallint.so orderm 3 113
orderm(3,113)=112
 ./rungcd ./libsmallint.so orderm 71 251
orderm(71,251)=250
 ./rungcd ./libsmallint.so orderm 6 229
orderm(6,229)=228
 g++ -o runmod runmod.cpp -L. -lsmallint -ldl
 ./runmod ./libsmallint.so mpower 2 10 69
mpower(2,10,69)=58
 ./runmod ./libsmallint.so mpower 2 100 69
mpower(2,100,69)=25
 ./runmod ./libsmallint.so mpower 4 50 9
mpower(4,50,9)=7
 ./rungcd ./libsmallint.so jacobi3 13 17
 ./rungcd ./libsmallint.so inv 3 19
inv(3,19)=13
 ./runmod ./libsmallint.so mpower 3 -1 19
mpower(3,-1,19)=13
jacobi3(13,17)=1
 ./rungcd ./libsmallint.so jacobi3 5 17
jacobi3(5,17)=1
 ./rungcd ./libsmallint.so jacobi4 13 17
jacobi4(13,17)=1
 ./rungcd ./libsmallint.so jacobi4 5 17
jacobi4(5,17)=-1
 ./runmod ./libsmallint.so Legendre 13 17 0
Legendre(13,17,0)=1
 ./runmod ./libsmallint.so Legendre 5 17 0
Legendre(5,17,0)=-1
 ./runmod ./libsmallint.so LogFFE 113 3 57
LogFFE(113,3,57)=100
 ./runmod ./libsmallint.so LogFFE 251 71 210
LogFFE(251,71,210)=197
 ./runmod ./libsmallint.so LogFFE 5 2 1
LogFFE(5,2,1)=4
 ./runmod ./libsmallint.so LogFFE 5 2 2
LogFFE(5,2,2)=1
 ./runmod ./libsmallint.so LogFFE 5 2 3
LogFFE(5,2,3)=3
 ./runmod ./libsmallint.so LogFFE 5 2 4
LogFFE(5,2,4)=2


20181218添加:
Linux下编译cocos2d-x 2.0.3的lua库
root@ubuntu:/home/hanxiaohua/work1/MathTool/lua# vim Makefile
root@ubuntu:/home/hanxiaohua/work1/MathTool/lua# make
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# g++ -o luatest luatest.cpp -L../lua/ -llua5.1
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# ./luatest
Hello, World!
Press enter to exit...
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# g++ -o fsimp0 fsimp0.cpp -L../lua -llua5.1 -ldl
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# ./fsimp0
The sum is 21
luapythagorean(3,4)=5.000000
fsimp(a,b,eps,luafun)=4.999995e-01

root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# g++ -o fsimp1 fsimp1.cpp -L../lua -llua5.1 -ldl
../lua/liblua5.1.a(loslib.o): In function `os_tmpname':
/home/hanxiaohua/work1/MathTool/lua/loslib.c:60: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib# ./fsimp1
fsimp(a,b,eps,luafun)=4.999995e-01
调用fsimp计算某些定积分∫[a->b]f(x)dx,请输入a、b以及包含f(x)的lua脚本文件名、lua函数名,这里eps=0.000001:
0
1.414
fsimp1.lua
fun
fsimp(a,b,eps,luafun)=4.999978e-01
exit with pressing e:调用fsimp计算某些定积分∫[a->b]f(x)dx,请输入a、b以及包含f(x)的lua脚本文件名、lua函数名,这里eps=0.000001:
0
1.414
fsimp1.lua
fun1
fsimp(a,b,eps,luafun)=1.511968e+00
exit with pressing e:调用fsimp计算某些定积分∫[a->b]f(x)dx,请输入a、b以及包含f(x)的lua脚本文件名、lua函数名,这里eps=0.000001:
0
1.414
fsimp0.lua
fun
fsimp(a,b,eps,luafun)=4.999978e-01
exit with pressing e:调用fsimp计算某些定积分∫[a->b]f(x)dx,请输入a、b以及包含f(x)的lua脚本文件名、lua函数名,这里eps=0.000001:
e
fsimp(a,b,eps,luafun)=4.999978e-01
exit with pressing e:
root@ubuntu:/home/hanxiaohua/work1/MathTool/mathlib#

技术栈:
cocos-js客户端+linux c++服务器+mysql+redis数据库
凌建风cocos2d-js
前身为cocos2d-html5,2014.3改名,2015.7被并入cocos2d-x 3.7引擎中,结构分为4层
Ubuntu 14.04 官方正式版
https://www.jb51.net/softs/163109.html
ubuntu-14.04.5-desktop-amd64.iso
ubuntu-14.04.5-server-amd64.iso
http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso
http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso
在Ubuntu Server 14.04.5 LTS下安装VMware Tools
https://blog.csdn.net/qq_26819733/article/details/52820101
C:\Program Files (x86)\VMware\VMware Workstation\linux.iso
请确保您已经登录客户机操作系统。在客户机中装载虚拟CD驱动器,启动终端,使用tar解压缩安装程序,然
后执行vmware-install.pl安装VMware Tools。
mkdir /mnt/cdroom
mount /dev/cdroom /mnt/cdrom
cd /mnt/cdroom
ls
cp VMwareTools-10.0.0-2977863.tar.gz /mnt/VMwareTools-10.0.0-2977863.tar.gz
cd /mnt
tar -zxvf VMwareTools-10.0.0-2977863.tar.gz
ls
cd vmware-tools-distrib
./vmware-install.pl


先按ESC键,然后敲:,这时才可以敲命令,比如强行退出可以敲q! enter(回车),如果需要保存退出就敲 “:x enter(回车)”或者“wq enter(回车)”
/bin/bash^M: bad interpreter: 没有那个文件或目录
vim sh_ver.sh
:set ff?
如果出现fileforma=dos那么就基本可以确定是这个问题了。
:set fileformat=unix
:wq
sh_ver.sh
room version:1.0.0.0_20181018
make

Linux程序设计(第4版)
2010年6月第1版
Linux并不要求可执行程序或脚本文件具有特殊名或扩展名。
文件系统属性用来指明一个文件是否为可执行程序。
当登录进Linux系统时,你与一个shell程序(通常是bash)进行交互,它像Windows中的命令提示窗口一样运行程序。
它在一组指定的目录路径下按照你给出的程序名搜索与之同名的文件。
搜索的目录路径存储在shell变量PATH里,这一点与Windows也很类似。
搜索路径由系统管理员配置,它通常包含如下一些存储系统程序的标准路径。
/bin:二进制文件目录
/usr/bin:用户二进制文件目录
/usr/local/bin:本地二进制文件目录
系统管理员(例如root用户)登录后使用的PATH变量可能还包含存放系统管理程序的目录,如/sbin和/user/sbin。
可选的操作系统组件和第三方应用程序可能被安装在/opt目录下,安装程序可以通过用户安装脚本将路径添加到PATH环境变量中。
注意1:Unix/Linux使用冒号:分割PATH变量里的条目,而MS-DOS/Windows使用分号;
注意2:Unix/Linux使用正斜线/分割文件名里的目录名,而MS-DOS/Windows使用反斜线\
gcc随Linux的发行版一起提供。
第一个Linux C语言程序
gcc -o hello hello.c
./hello
许多Linux发行版有个名为软件开发的安装选项,你应该在安装过程中选中该项,从而确保安装了所需的软件包。
符号.代表当前目录
-o name选项告诉编译器可执行程序的名字。
a.out的含义是汇编输出。
gcc -I/usr/openwin/include fred.c
.a代表静态函数库或归档文件
.so代表共享函数库
ar是一个通用工具
一些重要的目录:
/usr/bin
/usr/local/bin
/opt
/usr/X11
/usr/bin/X11
/usr/lib/gcc
/usr/include
/usr/include/sys
/usr/include/linux
/usr/include/X11
/usr/include/c++
/lib
/usr/lib
查看shell的版本号
/bin/bash --version
GNU bash,version 4.3.11(1)-release (x86_64-pc-linux-gnu)
find:在系统中搜索文件
用来在本地机器上查找名为math的文件
find / -name math -print
grep:通用正则表达式解析器,在文件中搜素字符串
grep line *.txt
ifconfig -a
查看主机中所有网络接口的信息
Linux是一个多用户、多任务操作系统。
在Linux中用户主要有root用户(超级用户)、虚拟用户(伪用户、假用户)、普通用户3类。
在访问ftp时,会用到用户ftp或nobody
bin、daemon、mail
在Linux中,默认账户是普通用户,而更改系统文件或者执行某些命令,需要root身份才能进行,这就需要从
当前用户切换到root用户。
切换用户su
以其他用户身份执行命令sudo
sudo passwd root
输入普通用户密码
输入123456
再次输入123456
su root
输入123456
hanxiaohua@ubuntu:~$
变为root@ubuntu:/home/hanxiaohua#
Linux系统运维
2014年9月第1版
chap2 Linux系统日常运维管理
主要包括用户管理、软件包管理、文件管理、计划任务设置等。
groups:显示组
whoami:显示当前用户名称
who:显示登录用户
id:显示用户信息
ac:显示用户在线时间的统计信息【未安装】
lastlog:显示最近登录用户的用户名、登录端口和登录时间
logname:显示当前用户的名称
users:显示当前登录到系统的用户
ls:显示文件名
ls /usr/bin
date:显示日期和时间
hostname:显示主机名
vim编辑器是对vi的扩充与增强。
vim分为命令和输入两种工作模式。
通过使用vim命令和Esc键,可以在两种工作模式之间互相转换。
Ubuntu实战技巧精粹
2009年5月第1版
本书是完全面向技巧的,推荐读者阅读《UNIX编程环境》这一经典著作。
RTFM是Read The Fucking Manual的缩写。
Ubuntu 7.10的DVD的镜像ubuntu-7.10-dvd-i386.iso。
常用命令和Shell技巧
cd命令主要功能就是进行目录的切换
1、进入上一级目录
$cd ..
2、进入上上级目录
$cd ../..
3、快速进入用户的home目录
$cd ~
或者
$cd
4、返回进入当前用户前所在的目录
$cd -
5、把上一个命令的参数,当作cd的输入参数
6、使用别名快速进入某个目录
$alias gonet='cd /proc/sys/net/ipv4'
$gonet
cp命令的功能是将给出的文件或目录复制到另一个文件或目录中。
-b:删除,覆盖目标文件之前的备份,备份文件会在字尾加上一个备份字符串。
-f:删除已经存在的目标文件而不提示。
-i:和f选项相反,在覆盖目标文件之前将给出提示要求用户确认。回答y时目标文件将被覆盖,是交互式复制。
-r:若给出的源文件是一个目录文件,此时cp将递归复制该目录下所有的子目录和文件。此时目标文件必须为一个目录名。
$cp -i test1.doc /home/wanglin/my.doc
$cp test1.doc /home/wanglin/
$cp -r /home/wang/ /home/susu/
$cp *.mp3 /home/susu/
如果要复制第一个字符为-的文件,请使用以下其中一种方法:
$cp -- -foo /home/susu/
或者
$cp ./-foo /home/susu/
$cp -b -S @ aa.c /home/susu/
$cp /dev/cdrom/ /home/susu/my.iso
chap9 开发工具
make命令不仅仅用于编译程序。
makefile文件一般都会和项目的其他源文件放在同一目录下。
你可以用多个不同的makefile文件来分别管理项目的不同部分。
makefile文件由一组依赖关系和规则构成。
每个依赖关系由一个目标(即将要创建的文件)和一组该目标所依赖的源文件组成。
而规则描述了如何通过这些依赖文件创建目标。
一般来说,目标是一个单独的可执行文件。
make命令最常用的3个选项:
-k:
-n:
-f:
依赖关系定义了最终应用程序里的每个文件和源文件之间的关系。
这些规则的写法是:先写目标的名称,然后紧跟着一个冒号,接着是空格或制表符tab,最后是用空格或制表符
tab隔开的文件列表(这些文件用于创建目标文件)。
规则定义了目标的创建方式。
makefile文件中一个非常奇怪而又令人遗憾的语法现象:空格和制表符tab是有区别的
规则所在的行必须以制表符tab开头,用空格是不行的。
make命令内置了很多默认规则,但如果需要指定头文件目录,或者为了今后的调试需要设置符号信息选项,就需要在makefile文件中明确定义一些规则。
ps与grep组合命令使用 - 我弟是个程序员 - CSDN博客 https://blog.csdn.net/She_lock/article/details/79673415
查询名字有room的进程
ps -ef | grep room
Linux下*.tar.gz文件解压缩命令
1.压缩命令:
命令格式:tar  -zcvf   压缩文件名.tar.gz   被压缩文件名
可先切换到当前目录下。压缩文件名和被压缩文件名都可加入路径。
2.解压缩命令:
命令格式:tar  -zxvf   压缩文件名.tar.gz
解压缩后的文件只能放在当前的目录
查看gcc版本
gcc -v
gcc版本4.4.7 20120313 ( Red Hat 4.4.7-23) (GCC)
Redis可视化工具 Redis Desktop Manager - zheting - 博客园 https://www.cnblogs.com/zheting/p/7670154.html
Redis_百度百科 https://baike.baidu.com/item/Redis/6549233?fr=aladdin
Redis在win7上的可视化应用 - 王磊的博客 - 博客园 https://www.cnblogs.com/stone_w/p/4757578.html
Svn与Git的区别 - motian - 博客园 https://www.cnblogs.com/mtl-key/p/6902627.html
免费Git客户端:sourcetree详细介绍 - 流浪的诗人 - 博客园 https://www.cnblogs.com/wdlhao/p/9022511.html
SourceTree的基本使用 - 天字天蝎 - 博客园 https://www.cnblogs.com/tian-xie/p/6264104.html
Git学习笔记(SourceTree克隆、提交、推送、拉取等) - gamedaybyday - 博客园 https://www.cnblogs.com/gamedaybyday/p/6373312.html
Git SourceTree Please, commit your changes or stash them before you can merge. - YLGWHYH的专栏 - CSDN博客 https://blog.csdn.net/ylgwhyh/article/details/50419207
sourceTree 切换Git登录用户 - 刻剑求舟 - CSDN博客 https://blog.csdn.net/z769184640/article/details/46849823
git push错误failed to push some refs to的解决 - MBuger的博客 - CSDN博客 https://blog.csdn.net/mbuger/article/details/70197532
拉取失败的处理方法:
1、删除本地冲突的文件
2、在Git Bash里执行下面的命令同时恢复多个被删除的文件:
git ls-files -d | xargs -i git checkout {}
3、拉取
https://github.com/Ivanhan2018/MakeGUID
http://www.downza.cn/soft/204156.html
https://blog.csdn.net/jiangyu1013/article/details/78850735

20181022添加:
https://github.com/Ivanhan2018/MakeGUID.git
linux下chmod +x的意思?为什么要进行chmod +x - u012106306的博客 - CSDN博客 https://blog.csdn.net/u012106306/article/details/80436911
例如:
chmod +x room_brnn1
chmod +x nnoh.so
文件复制命令cp
删除文件命令rm
跨服务器拷贝命令scp
[root@bianyi ~]# cd /home/game_server/pdk_server/server/svn_svr/platform/trunk/room
[root@bianyi room]# cp table.cpp table.bak
[root@localhost room_mj]# mv room_zjh1 romm_zjh100
[root@bianyi room]# scp room root@192.168.20.246:/data/game_server/room/zjh1/room_mj/
[root@localhost room_mj]# mv room room_zjh1
[root@localhost room_mj]# rm ./log/4110/*.log
rm: remove regular file ‘./log/4110/20181023.log’? y
rm: remove regular file ‘./log/4110/20181024.log’? n
[root@localhost room_mj]# rm -rf ./log/4110/*.log
You have new mail in /var/spool/mail/root
查看代码的修改内容
[root@bianyi room]# git diff table.cpp
查看log
[root@bianyi room]# git log
提交部分代码加备注
[root@bianyi room]# git commit table.cpp -m "增加日志"
推送到远程服务器
[root@bianyi room]# git push origin master
vector<vector<string> >
如果少了空格,在Linux下gcc编译时会提示:
错误:在嵌套模板实参列表中应当使用‘> >’而非‘>>’
linux 查看当前路径命令:pwd - 郑文亮 - 博客园 https://www.cnblogs.com/zhwl/p/3670712.html
247编译机器:
cds
git pull
pwd
/home/game_server/pdk_server
cd /home/game_server/pdk_server/server/svn_svr/game/trunk/NNOH
make
246部署机器:
cd /data/game_server/room/brnn1/room_brnn1
ps -ef|grep room
stop.sh
kill 104760
restart.sh
ps -ef|grep room
247编译机器:
[root@bianyi ~]# git --version
git version 1.7.1
[root@bianyi hxh]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright ? 2010 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。
246部署机器:
[root@localhost ~]# git --version
git version 1.8.3.1
You have new mail in /var/spool/mail/root
[root@localhost git]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You have new mail in /var/spool/mail/root
查看CentOS版本信息
[root@instance-3h0vsi80 cpptest]# uname -a
Linux instance-3h0vsi80 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@instance-3h0vsi80 cpptest]# lsb_release -a
LSB Version::core-4.1-amd64:core-4.1-noarch
Distributor ID:CentOS
Description:CentOS Linux release 7.7.1908 (Core)
Release:7.7.1908
Codename:Core
20.247:
[root@bianyi hxh]# cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
[root@bianyi hxh]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@bianyi hxh]# cat /proc/version
Linux version 2.6.32-642.el6.x86_64 (mockbuild@worker1.bsys.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Tue May 10 17:27:01 UTC 2016
[root@bianyi hxh]# uname -a
Linux bianyi 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@bianyi hxh]# uname -r
2.6.32-642.el6.x86_64
[root@bianyi hxh]# getconf LONG_BIT
64
[root@bianyi hxh]# getconf WORD_BIT
32
[root@bianyi hxh]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
20.246:
[root@localhost git]# cat /etc/issue
\S
Kernel \r on an \m
You have new mail in /var/spool/mail/root
[root@localhost git]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@localhost git]# cat /proc/version
Linux version 3.10.0-862.11.6.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Tue Aug 14 21:49:04 UTC 2018
[root@localhost git]# getconf LONG_BIT
64
[root@localhost git]# uname -a
Linux localhost.localdomain 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost git]# uname -r
3.10.0-862.11.6.el7.x86_64
[root@localhost git]# getconf WORD_BIT
32
[root@localhost git]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c5ad78cfc1de12b9bb6829207cececb990b3e987, stripped
222.128:
[root@localhost git-2.9.5]# cat /etc/issue
\S
Kernel \r on an \m
[root@localhost git-2.9.5]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@localhost git-2.9.5]# cat /proc/version
Linux version 3.10.0-862.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018
[root@localhost git-2.9.5]# uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost git-2.9.5]# uname -r
3.10.0-862.el7.x86_64
[root@localhost git-2.9.5]# getconf LONG_BIT
64
[root@localhost git-2.9.5]# getconf WORD_BIT
32
[root@localhost git-2.9.5]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c5ad78cfc1de12b9bb6829207cececb990b3e987, stripped
【数据库开发】windows环境下通过c++使用redis - ZhangPY的专栏 - CSDN博客 https://blog.csdn.net/lg1259156776/article/details/54631943
windows下使用C++访问redis - 不屑哥的专栏 - CSDN博客 https://blog.csdn.net/fuck487/article/details/61914732
启动redis:
D:\redis-2.6>redis-server.exe redis.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.6.12 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 264
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'
[264] 26 Oct 09:13:02.793 # Server started, Redis version 2.6.12
[264] 26 Oct 09:13:02.798 * The server is now ready to accept connections on port 6379
测试使用:
D:\redis-2.6>redis-cli -h 192.168.1.110 -p 6379
redis 192.168.1.110:6379>
mysql加字段:
ALTER TABLE test ADD COLUMN xml text
20181217添加:
查看库的版本是32位还是64位
root@ubuntu:/home/hanxiaohua/work/MakeGUID/GameServer/src# objdump -p ../lib/libreactor.a
In archive ../lib/libreactor.a:
MarkupSTL.o:     file format elf32-i386
cache.o:     file format elf32-i386
mempool.o:     file format elf32-i386
net.o:     file format elf32-i386
log.o:     file format elf32-i386
config.o:     file format elf32-i386
poller.o:     file format elf32-i386
timerlist.o:     file format elf32-i386
tm_task.o:     file format elf32-i386
CCReactor.o:     file format elf32-i386
CCSocketServer.o:     file format elf32-i386
CCSocketHandler.o:     file format elf32-i386
CCTimerHandler.o:     file format elf32-i386
Version.o:     file format elf32-i386
root@ubuntu:/home/hanxiaohua/work/MakeGUID/GameServer/src# objdump -p ../lib/libreactor.so
../lib/libreactor.so:     file format elf32-i386
Program Header:
    PHDR off    0x00000034 vaddr 0x00000034 paddr 0x00000034 align 2**2
         filesz 0x00000100 memsz 0x00000100 flags r-x
  INTERP off    0x00034b6d vaddr 0x00034b6d paddr 0x00034b6d align 2**0
         filesz 0x00000013 memsz 0x00000013 flags r--
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x0003e283 memsz 0x0003e283 flags r-x
    LOAD off    0x0003e284 vaddr 0x0003f284 paddr 0x0003f284 align 2**12
         filesz 0x00001184 memsz 0x00001250 flags rw-
 DYNAMIC off    0x0003e4e4 vaddr 0x0003f4e4 paddr 0x0003f4e4 align 2**2
         filesz 0x000000f0 memsz 0x000000f0 flags rw-
    NOTE off    0x00000134 vaddr 0x00000134 paddr 0x00000134 align 2**2
         filesz 0x00000024 memsz 0x00000024 flags r--
EH_FRAME off    0x00034b80 vaddr 0x00034b80 paddr 0x00034b80 align 2**2
         filesz 0x000018ac memsz 0x000018ac flags r--
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-
Dynamic Section:
  NEEDED               libpthread.so.0
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  INIT                 0x000181e8
  FINI                 0x00033898
  INIT_ARRAY           0x0003f284
  INIT_ARRAYSZ         0x0000000c
  GNU_HASH             0x00000158
  STRTAB               0x000062c8
  SYMTAB               0x00001cc8
  STRSZ                0x0000f77f
  SYMENT               0x00000010
  PLTGOT               0x0003f648
  PLTRELSZ             0x00001958
  PLTREL               0x00000011
  JMPREL               0x00016890
  REL                  0x000163d8
  RELSZ                0x000004b8
  RELENT               0x00000008
  VERNEED              0x00016308
  VERNEEDNUM           0x00000004
  VERSYM               0x00015a48
  RELCOUNT             0x00000010
Version References:
  required from libgcc_s.so.1:
    0x0d696910 0x00 10 GLIBC_2.0
    0x0b792650 0x00 09 GCC_3.0
  required from libstdc++.so.6:
    0x056bafd3 0x00 07 CXXABI_1.3
    0x0297f865 0x00 06 GLIBCXX_3.4.15
    0x08922974 0x00 04 GLIBCXX_3.4
  required from libpthread.so.0:
    0x0d696910 0x00 03 GLIBC_2.0
  required from libc.so.6:
    0x0d696911 0x00 08 GLIBC_2.1
    0x09691f73 0x00 05 GLIBC_2.1.3
    0x0d696910 0x00 02 GLIBC_2.0
Linux(Ubuntu)下MySQL的安装与配置
root@ubuntu:~# sudo netstat -tap | grep mysql
root@ubuntu:~# sudo apt-get install mysql-server mysql-client
root@ubuntu:~# sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      12204/mysqld
root@ubuntu:~# mysql -uroot -p -h192.168.1.165 -P3306
Enter password:
root@ubuntu:~# mysql -uroot -pmysql55 -h192.168.1.165 -P3306
root@ubuntu:~# mysql -uroot -p
Enter password:
root@ubuntu:~# sudo mysqladmin -u root password mysql55
root@ubuntu:~# sudo stop mysql
mysql stop/waiting
root@ubuntu:~# sudo start mysql
mysql start/running, process 12416
设置远程访问方法
root@ubuntu:~# sudo vi /etc/mysql/my.cnf
root@ubuntu:~# mysql -uroot -pmysql55
mysql> show databases;
mysql> use mysql;
mysql> update user set host='%' where user='root' and host='localhost';
root@ubuntu:~# sudo service mysql restart
mysql stop/waiting
mysql start/running, process 12600
mysql> quit

 
20181104:
win8.1宿主机ip:192.168.1.165
ubuntu server虚拟机ip:192.168.1.166
NAT模式改为桥接模式后,可互相ping通
虚拟机安装ssh服务后,xftp、xshell均可连接虚拟机。
在线安装gcc:
apt-get install gcc
gcc -v
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
在线安装g++:
apt-get install g++
在线安装make、yum:
apt-get install make
make -v
GNU Make 3.81
apt-get install yum
yum search "gcc-c++"
在线安装git:
apt-get install git
root@ubuntu:/home/hanxiaohua/work# git --version
git version 1.9.1
root@ubuntu:/home/hanxiaohua/struct_tool-master# cd /home/hanxiaohua/work
root@ubuntu:/home/hanxiaohua/work# git init
Initialized empty Git repository in /home/hanxiaohua/work/.git/
root@ubuntu:/home/hanxiaohua/work# git clone https://github.com/Ivanhan2018/MakeGUID
1、在线安装
yum install gcc
yum install gcc-c++
2、离线安装
下载CentOS-7-x86_64-DVD-1804.iso,解压iso文件,进入Packages文件夹,拷贝如下.rpm文件至CentOS系统。
执行
rpm -Uvh *.rpm --nodeps --force
然后使用
gcc -v
g++ -v
git log
20181031:
Centos查看虚拟机IP地址及使用XShell连接 - ryelqy的博客 - CSDN博客 https://blog.csdn.net/ryelqy/article/details/77279711
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:b7:40:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.222.128/24 brd 192.168.222.255 scope global noprefixroute dynamic ens33
       valid_lft 1266sec preferred_lft 1266sec
    inet6 fe80::9b37:a1b9:5771:2d6f/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@localhost ~]# sudo service network restart
Restarting network (via systemctl):                        [  确定  ]
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
20191007:
固定ip的Ubuntu 18.04虚拟机克隆后无法上网的解决方案:
cp /etc/udev/rules.d/70-snap.core.rules ~ #备份
rm /etc/udev/rules.d/70-snap.core.rules
reboot
vim /etc/network/interfaces
注意此处ens33用自己的网卡编号替换
auto ens33改为ens33 00:0C:29:05:35:3D
vim /etc/netplan/*.yaml
固定ip由192.168.31.69改为192.168.31.67
root@yiyouserver:~# vim /etc/hostname
root@yiyouserver:~# vim /etc/cloud/cloud.cfg
preserve_hostname: true  #这里是将false改成true
root@yiyouserver2:~# cat /etc/hostname
yiyouserver2


vmware和virtual box同时装的影响
影响就是同时有多块网卡,vmware选择bridged模式时,要把网卡选为真实网卡,不能选到virtualbox的虚拟网卡上。如果选错则vmware不能和外界互相ping通.
在vmware的edit->virtual network editor里设置网卡0为真实网卡。

主机模式
VMware Network Adapter VMnet1
192.168.130.1
在host-only模式下,虚拟系统的TCP/IP配置信息(如IP地址、网关地址、DNS服务器等),都是由VMnet1(host-only)虚拟网络的DHCP服务器来动态分配的。 

NAT模式
VMware Network Adapter VMnet8
192.168.139.1
NAT模式下的虚拟系统的TCP/IP配置信息是由VMnet8(NAT)虚拟网络的DHCP服务器提供的,无法进行手工修改,因此虚拟系统也就无法和本局域网中的其他真实主机进行通讯。

posted on 2019-11-12 22:28  梦回第四帝国  阅读(511)  评论(0)    收藏  举报

导航