使用MSVS 2010和C ++标准构建问题 [英] Build issue with MSVS 2010 and the C++ standard

查看:143
本文介绍了使用MSVS 2010和C ++标准构建问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



https://github.com/Joonhwan/exprtk



问题是当我注释掉行48' #define exprtk_lean_and_mean'在exprtk.hpp文件中,我得到以下编译器错误:

 错误1错误C1128:对象文件格式限制:使用/ bigobj $ b编译

Googling错误,似乎表明编译的翻译单元已经编译成大于仲裁限制的内容,并且在命令行中添加bigobj应该解决问题(它的作用)。



我的问题是:


  1. c ++对翻译单元中可以使用的类型数量有限制吗?


  2. 是在这个项目中布置不好的做法吗? (当谷歌搜索我注意到很多提升库有相同的问题,例如:Boost.Sprit)



解决方案

c ++是否对翻译单元中可以使用的类型数量设置了限制?



这些参数的最大值对于特定实现是开放的。该标准仅强制实施必须支持的最低要求。一个实现将记录它支持的最大值,在这种情况下MSVC实现这样做。



这些是在C ++标准的特殊部分定义的。



附件B - 执行数量



  1. 因为计算机是有限的,C ++实现不可避免地限制了
    在它们可以
    成功处理的程序的大小。 每个
    实施应记录已知的
    限制。

    文档可能引用固定限制
    ,如果它们存在,说如何计算
    变量限制作为
    可用资源的函数,或者说固定的
    限制不存在或未知。


  2. 约束包括下面描述的数量或
    其他。
    每个数量后面的括号中的数字推荐为该数量的最低
    但是,
    这些数量只是指导原则
    ,不能确定合规性。

    复合语句的嵌套级别,
    迭代控制结构和
    选择控制结构[256]。
    -
    条件$ b的嵌套级别$ b inclusion [256]。
    指针,数组和
    函数声明符(任何
    组合)修改算术,
    结构,联合或不完整类型
    在声明中[256] 。
    - 在完整表达式[256]内嵌套
    括号表达式的级别

    -
    内部
    标识符或宏名称中的字符数[1 024]。
    -
    外部
    标识符中的字符数[1 024]。
    外部
    标识符在一个翻译单元中
    [65 536]。
    - 在一个块中声明块
    作用域的标识符[1 024]。
    -
    同时标识宏标识符
    在一个翻译单元中定义[65
    536]。
    一个函数中的参数
    definition [256]。
    一个
    函数调用中的参数调用[256]。** -
    中的参数一个宏定义[256]。
    -
    一个宏调用中的参数
    [256]。
    一个逻辑
    源行中的字符[65 536]。

    中的字符字符串文字或宽字符
    字符串字符串(连接后)
    [65 536]。
    - 物件的尺寸[262
    144]

    - #include
    文件的嵌套级别[256]。
    -
    switch语句的case标签(不包括
    任何嵌套switch语句的情况)[16
    384]。
    单个
    类,结构或联合中的数据成员[16 384]。
    -
    单个
    枚举中的枚举常数[4 096]。
    级别
    在单个
    struct-declaration-list [256]中嵌套类,结构或联合
    定义。
    -
    atexit()注册的函数[32]。
    apers - 直接和间接基类[16
    384]。 - 一个
    单类的直接基类[1024]。
    成员
    在单个类中声明[4 096]。
    -

    中的最终覆盖虚拟函数a类,可访问或不可访问[16 384]。
    -

    类的直接和间接虚拟基础[1 024]。
    -
    类的静态成员[1 024]。
    - 在类[4 096]中的朋友声明


    - 在类[4 096]中访问控制
    声明。
    -
    构造函数中的成员初始化器
    定义[6 144]。

    范围
    一个标识符的资格
    [256]。
    - 嵌套外部
    规格[1 024]。

    在模板声明中模​​板
    参数[1
    024]。
    - 递归嵌套模板
    instantiations [17]。 - - 处理程序每​​
    try块[256]。
    - 在单个函数上抛出
    规范
    声明[256]。




I'm trying to build, using msvs 2010 the project found at the following git:

https://github.com/Joonhwan/exprtk

The problem is when I comment out the line 48 '#define exprtk_lean_and_mean' in exprtk.hpp file, I get the following compiler error:

Error   1   error C1128: number of sections exceeded object file format limit : compile with /bigobj

Googling the error, seems to indicate the the compiled translation unit has compiled to something larger than an arbitariy limit, and adding 'bigobj' to the command line should fix the problem (which it does). Compiling the code with gcc (4.3), works without a glitch.

My questions are:

  1. Does c++ place a limit on the number of types that can be had in a translation unit?

  2. Is the way the code is laid out in this project bad practice? (when googling I noticed a lot of boost libraries have the same problem eg: Boost.Sprit)

解决方案

Does c++ place a limit on the number of types that can be had in a translation unit?

Note that the maximum values of such parameters are left open for particular implementations. The standard only enforces minimum requirements that must be supported by an implementation. An implementation will document the maximum values it supports and in this case MSVC implementation does so.

These are defined in a special section of the C++ standard.

Annex B - Implementation quantities

  1. Because computers are finite, C + + implementations are inevitably limited in the size of the programs they can successfully process. Every implementation shall document those limitations where known. This documentation may cite fixed limits where they exist, say how to compute variable limits as a function of available resources, or say that fixed limits do not exist or are unknown.

  2. The limits may constrain quantities that include those described below or others. The bracketed number following each quantity is recommended as the minimum for that quantity. However, these quantities are only guidelines and do not determine compliance.
    — Nesting levels of compound statements, iteration control structures, and selection control structures [256].
    — Nesting levels of conditional inclusion [256].
    — Pointer, array, and function declarators (in any combination) modifying an arithmetic, structure, union, or incomplete type in a declaration [256].
    — Nesting levels of parenthesized expressions within a full expression [256].
    — Number of characters in an internal identifier or macro name [1 024].
    — Number of characters in an external identifier [1 024].
    — External identifiers in one translation unit [65 536].
    — Identifiers with block scope declared in one block [1 024].
    — Macro identifiers simultaneously defined in one translation unit [65 536].
    — Parameters in one function definition [256].
    — Arguments in one function call [256].**
    — Parameters in one macro definition [256].
    — Arguments in one macro invocation [256].
    — Characters in one logical source line [65 536].
    — Characters in a character string literal or wide string literal (after concatenation) [65 536].
    Size of an object [262 144].
    — Nesting levels for #include files [256].
    — Case labels for a switch statement (excluding those for any nested switch statements) [16 384].
    — Data members in a single class, structure, or union [16 384].
    — Enumeration constants in a single enumeration [4 096].
    — Levels of nested class, structure, or union definitions in a single struct-declaration-list [256].
    — Functions registered by atexit()[32].
    — Direct and indirect base classes [16 384].
    — Direct base classes for a single class [1024].
    — Members declared in a single class [4 096].
    — Final overriding virtual functions in a class, accessible or not [16 384].
    — Direct and indirect virtual bases of a class [1 024].
    — Static members of a class [1 024].
    — Friend declarations in a class [4 096].
    — Access control declarations in a class [4 096].
    — Member initializers in a constructor definition [6 144].
    — Scope qualifications of one identifier [256].
    — Nested external specifications [1 024].
    — Template arguments in a template declaration [1 024].
    — Recursively nested template instantiations [17].
    — Handlers per try block [256].
    — Throw specifications on a single function declaration [256].

这篇关于使用MSVS 2010和C ++标准构建问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆