小编Mar*_*dej的帖子

CMake clang的CMake构建失败,"执行llvm-build的意外失败:Traceback(...)import llvmbuild"

我想构建LLVM clang编译器,但CMake最终会出现以下错误消息:

CMake Error at CMakeLists.txt:256 (message):
  Unexpected failure executing llvm-build: Traceback (most recent call
last):

    File "C:/.../llvm/utils/llvm-build/llvm-build", line 3, in
<module>
      import llvmbuild
    File "C:\...\llvm\utils\llvm-build\llvmbuild\__init__.py",
line 1, in
<module>
      from main import main

  ImportError: No module named main


-- Configuring incomplete, errors occurred!
Run Code Online (Sandbox Code Playgroud)

我已经安装了所有需要的工具.

  • 操作系统:Windows 7 x64
  • Python:3.2.2(x86-64)
  • GnuWin32:0.6.3

python build llvm clang

15
推荐指数
1
解决办法
4589
查看次数

Matlab:如何读取以逗号作为小数分隔符的数字?

我有很多(数十万)相当大(>0.5MB)的文件,其中数据是数字,但以逗号作为小数分隔符。使用像 之类的外部工具对我来说是不切实际的sed "s/,/./g"。当分隔符是点时,我只使用textscan(fid, '%f%f%f'),但我看不到更改小数点分隔符的选项。如何有效地读取这样的文件?

文件中的示例行:

5,040000    18,040000   -0,030000
Run Code Online (Sandbox Code Playgroud)

注意: R有类似的问题,但我使用 Matlab。

file-io matlab decimal-point

5
推荐指数
1
解决办法
1万
查看次数

如何测试某些代码不能在C ++中编译?

可能重复:
单元测试编译时错误

我想知道是否有可能编写一种单元测试来验证给定的代码不会编译。

例如,我有一个模板类:

#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>

struct bar_base {};

template <typename T>
class foo 
{
    BOOST_STATIC_ASSERT(::boost::is_base_of<T, bar_base>::value);
};
Run Code Online (Sandbox Code Playgroud)

因此,测试应成功完成:

struct bar_derived : bar_base {};
foo<bar_derived> f;
Run Code Online (Sandbox Code Playgroud)

但应该失败:

struct bar_other {};
foo<bar_other> f;
Run Code Online (Sandbox Code Playgroud)

有什么想法如何实现这种行为?(现在,我必须取消注释失败的代码,并手动验证是否存在编译错误-我想避免这种情况)

c++ testing templates unit-testing compilation

5
推荐指数
1
解决办法
852
查看次数

模板参数包会引发错误,而显式参数则不会

以下代码(现场演示)在 clang/gcc 上运行良好,但在 icc 和 msvc 上编译失败。

唯一的区别是在 中使用模板参数包class A,而class B显式给出所有模板参数。

什么是正确的行为?代码是否错误?我错过了什么吗?或者只是因为 msvc/icc 不符合标准?

更新

测试的编译器版本:

作品:

  • 海湾合作委员会 4.7.3、4.8.1、4.8.2、4.9.0、4.9.2
  • 铿锵 3.3、3.4.1、3.5.0、3.5.1、3.6.0rc2

不起作用:

  • msvc-12.0 (2013) 更新 4
  • icc-13.0.1

代码

#include <unordered_map>

template <class Container>
struct A
{};

// the following won't compile on some compilers (msvc, icc)
template <class... Args>              // line 8
struct A<std::unordered_map<Args...>> // line 9
{
};

template <class Container>
struct B
{};

// the following compiles fine
template <class K, class …
Run Code Online (Sandbox Code Playgroud)

c++ templates variadic-templates c++11

5
推荐指数
1
解决办法
1261
查看次数