ubuntu - 程序运行的一些基础知识
1.指定编码格式
-finput-charset=GB2312 指定 C 程序的编码方式为 GB2312,不指定时默认编码方式为 UTF-8
-fexec-charset=GB2312 指定 可执行程序的编码方式为 GB2312,不指定时默认编码方式为 UTF-8
2.编译链接时找不到函数、找不到库
1.编译时头文件在交叉编译工具链中的include目录,也可以在编译时用 "-I dir" 指定
2.链接是库文件在交叉编译工具链中的lib目录,也可以在编译时用 "-L dir" 指定,用 "-labc" 包含库文件 abc.so
3.运行时库文件在板子上的/lib、/usr/lib目录
3.执行以下命令,列出头文件目录、 库目录(LIBRARY_PATH)
echo 'main(){}'| arm-linux-gnueabihf-gcc -E -v -
-E 预处理 Preprocess only; do not compile, assemble or link.
-v 显示编译器调用的程序 Display the programs invoked by the compiler.

4.交叉编译万能命令
./configure --host=arm-linux-gnueabihf --prefix=$PWD/tmp
make
make install
浙公网安备 33010602011771号