-
此文仅记录C++ 和QT 学习过程中一些琐碎知识点.
-
shadow build 是将源码路径和构建路径分开,主要将makefile和其它生成的文件分开,保证源码文件的清洁,qmke和cmake都有采用.
-
.pro.user,用于记录打开工程的路径,所用的编译器、构建的工具链、生成目录、打开工程的qt-creator的版本等。
当更换编译环境时,要将其删除。
-
带形参的main函数,如 main( int argc, char* argv[], char **env ) ,是UNIX、Linux以及Mac OS操作系统中C/C++的main函数标准写法,并且是血统最纯正的main函数写法。 在如今的Visual Studio编译器中,main()函数带有参数argc和argv或者不带,即无论是否在函数体中使用argc和argv,返回值为void或不为void,都是合法的。
-
c_str是string类的一个函数,可以把string类型变量转换成char*变量;open()要求的是一个char*字符串
#include <iostream>
std::ifstream
ifstream infile;
string filename;
infile.open(filename.c_str())
-
头文件中对函数进行声明,main函数中直接引用头文件,即可调用其声明的函数;声明的函数的定义可在.cpp文件中描述,同样也要引用此头文件。
-
int open(const char* pathname, int flags)
int open(const char* pathname, int flags, mode_t mode);
参数pathname 指向欲打开的文件路径字符串,下列参数是flags的范围:
O_RDONLY :以只读的方式打开文件
O_WRONLY:以只写方式打开文件
O_RDWR:以可读写的方式打开文件 以上三种方式互斥; - QT中不能用中文注释解决方法:
- 将/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so拷贝到
~/opt/Qt/5.10.1/gcc_64/plugins/platforminputcontexts 和 ~/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts 中
- 解决ubuntu中解压zip出现乱码的问题
输入 unzip -O CP936 xxx.zip
-
os:time::now()输出的值是什么?
ros:time::now()输出的值与参数use_sim_time有关。
use_sim_time为true时,ros:time::now()输出系统时间;
use_sim_time为false时,ros:time::now()输出输出仿真时间,如果回放bag则是bag的时间。