Linux编译问题
linux中编译多个C++文件
g++ *.cpp -o targetName
linux中编译需要用到zlib.h
g++ *.cpp -o targetName -lz
linux移植错误
uint32_t has not been declared
#include <stdint.h>
linux中用C++11标准编译多个C++文件
g++ *.cpp -o targetName -std=c++11
linux下undefined reference to `pthread_join'
原因 : pthread不是Linux下的默认的库,也就是在链接的时候,无法
找到pthread库的入口地址,于是链接会失败
解决 : 在gcc编译的时候,附加加 -lpthread参数即可解决
g++ *.cpp -o targetName -lpthread
linux编译C++ 需要连接redis
g++ *.cpp -o main -I/usr/local/include/hiredis -lhiredis
class A
{
public:
void do() {}
};
会引起GCC报错: error: expected unqualified-id before 'do'
expected unqualified-id before 这个错误通常是因为语法
错误引起的, 如上一个语句没有用分号结尾之类的。这个也不例外,
原因就是 do是关键字, 函数名及变量的名字是不能和关键字重名的
其它
linux运行redis
locate redis-cli查看redis-cli的位置
运行 /usr/local/bin/redis-cli -h 127.0.0.1 -p 6379
TAILQ是FreeBSD/linux内核对双向队列操作的一种抽象,需要
#include <sys/queue.h>
uname -a
查看linux操作系统版本
查看linux磁盘剩余空间信息
df -hl