QNX的宏QNX_SOURCE
在qcc编译中宏QNX_SOURCE的作用是会包括POSIX的库函数,如果只加了-std=C++11,但没有QNX_SOURCE就算是包含了头文件#include <unistd.h>等,都是无法使用Linux的POSIX相关库函数,声明等。
add_definitions(-D_QNX_SOURCE)
也可以使用-std=gnu++11替代-std=C++11
-std=language
Specify the language standard. We currently support c99, iso9899:1999, c11, iso9899:2011, C++98, C++03, c++11, c++14, and c++17. For more information, see “Options Controlling C Dialect” in the gcc documentation at https://gcc.gnu.org/onlinedocs/.
There are additional variants of this option that enable vendor-specific compiler extensions: gnu99, gnu11, gnu++98, gnu++11, gnu++14, and gnu++17. If you use these variants, _QNX_SOURCE is defined automatically, and some other non-standard functionality of the compiler is enabled; see the gcc documentation. If you don't specify the -std, the defaults are gnu11 and gnu++14 for C and C++, respectively.
-stdlib=library
Select the C++ library type to use. This option maps to the -Y option as follows:
-stdlib= | -Y | Library |
---|---|---|
libc++ | _cxx | LLVM C++ |
libstdc++ | _gpp | GNU C++ |
For more information, see the -Y option below.
The header files supplied with the C library provide the proper declarations for the functions and for the number and types of arguments used with them. Constant values used in conjunction with the functions are also declared. The files can usually be included in any order, although individual function descriptions show the preferred order for specific headers.
If you want to conform to a given language standard, you can use the -std=language option for qcc. This option can cause certain portions of the header files to be omitted, which is likely to cause problems because functions that are defined by POSIX or that are specific to QNX Neutrino won't be defined.
You can then use the qcc -D option to define feature-test macros to specify the portions that you want to include. Here are the most commonly used feature-test macros:
- _POSIX_C_SOURCE=version
- Include those portions of the header files that relate to the given POSIX standard. For example, _POSIX_C_SOURCE=200809L specifies the IEEE Standard Portable Operating System Interface for Computer Environments - POSIX 1003.1-2008.
- _FILE_OFFSET_BITS=64
- Make the libraries use 64-bit file offsets.
- _LARGEFILE64_SOURCE
- Include declarations for the functions that support large files (those whose names end with 64).
- _QNX_SOURCE
- Include everything defined in the header files. This is defined by default if you don't specify a language standard.
Feature-test macros may be defined on the command line, or in the source file before any header files are included. The latter is illustrated in the following example, in which a POSIX-conforming application is being developed.
#define _POSIX_C_SOURCE 200809L #include <limits.h> #include <stdio.h> … #if defined(_QNX_SOURCE) #include "non_POSIX_header1.h" #include "non_POSIX_header2.h" #include "non_POSIX_header3.h" #endif
You can also set the POSIXLY_CORRECT environment variable to 1. This environment variable is used by Unix-style operating systems to alter behavior to comply with POSIX where it's different from the OS's default behavior. It's a de facto standard that isn't defined by POSIX.
For example, if POSIXLY_CORRECT is set, functions that check the length of a pathname do so before removing any redundant . and .. components. If POSIXLY_CORRECT isn't set, the functions check the length after removing any redundant components.
原文地址:https://www.cnblogs.com/sciapex/p/15016401.html
- 微信小程序的省市选择组件 citySelector分享
- 详述 Java 语言中的 String、StringBuffer 和 StringBuilder 的使用方法及区别
- Class与Style绑定
- 机器学习并不难
- android的RadioGroup讲解
- asp.net MVC 应用程序的生命周期
- 091031 T PowerShell Solution
- Rafy 框架 - 通用查询条件(CommonQueryCriteria)
- Vue.js系列之三模板语法
- EF基础知识小记三(设计器=>数据库)
- 性能优化总结(二):聚合SQL
- Vue.js系列之四计算属性和观察者
- EF基础知识小记四(数据库=>模型设计器)
- OEA ORM 框架中的冗余属性设计
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Educational Codeforces Round 81 (Rated for Div. 2) C.Obtain The String
- 深入了解 webpack 模块加载原理
- Java中的数字类解析(包括格式化数字、大数运算等等)
- 数据挖掘领域十大经典算法之—K-邻近算法/kNN(超详细附代码)
- 洛谷 P1019 单词接龙
- SpringBoot 将自制的Starter 发布到远程公服
- 【分享】优化rootfs的大小
- PAT (Advanced Level) Practice 1099 Build A Binary Search Tree (30 分)
- 前端国际化辅助工具——自动替换中文并翻译
- Codeforces Round #613 (Div. 2)A. Mezo Playing Zoma
- PAT (Advanced Level) Practice 1096 Consecutive Factors (20 分)
- Codeforces Round #613 (Div. 2)B. Just Eat It!
- java线程池(六):ForkJoinPool源码分析之二(WorkQueue源码)
- Codeforces Round #605 (Div. 3) D. Remove One Element
- 用python爬虫,pyinstaller写一个属于自己的彩虹屁生成器!