小编Aru*_*run的帖子

错误:编译C++程序时未在此作用域中声明uint64_t

我正在尝试一个简单的程序来打印时间戳值,steady_clock如下所示:

#include <iostream>
#include <chrono>
using namespace std;
int main ()
{
  cout << "Hello World! ";
  uint64_t now = duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count();
  cout<<"Value: " << now << endl;

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

但每当我这样编译时g++ -o abc abc.cpp,我总是会收到一个错误:

In file included from /usr/include/c++/4.6/chrono:35:0,
                 from abc.cpp:2:
/usr/include/c++/4.6/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
abc.cpp: In …
Run Code Online (Sandbox Code Playgroud)

c++ g++ c++11 c++-chrono

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

在Jenkins中记录解析规则

我正在使用Jenkins日志解析器插件来提取和显示构建日志.规则文件看起来像,

 # Compiler Error
 error /(?i) error:/

 # Compiler Warning
 warning /(?i) warning:/
Run Code Online (Sandbox Code Playgroud)

一切正常,但由于某些原因,在"Parsed Output Console"的末尾,我看到这条消息,

NOTE: Some bad parsing rules have been found:

Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
Run Code Online (Sandbox Code Playgroud)

这一点,我肯定是一个微不足道的问题,但目前还无法解决这个问题.请帮忙 :)

编辑: 基于Kobi的答案,并查看了"解析规则文件",我这样修复它(冒号后的单个空格).这完美按预期工作.

# Compiler Error
error /(?i)error: /

# Compiler Warning
warning /(?i)warning: /
Run Code Online (Sandbox Code Playgroud)

regex continuous-integration gcc jenkins

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

侵犯隐私 - C++标准如何处理它?

请考虑以下代码段.

Sayhi()方法在类Base中具有公共访问权限.

Sayhi()已被类Derived重写为私有方法.

通过这种方式,我们可以侵入某人的隐私,而C++无法检测到它,因为事情是在运行时发生的.

我理解这是"纯粹的"编译时检查.但是当使用一些厚的继承层次结构时,程序员可能会错误地更改访问说明符.标准不应该至少有一些说法吗?某种警告信息.

每当被覆盖或虚函数的访问说明符不同时,为什么编译器不会发出警告消息?

Q1.C++标准对这种运行时异常有什么发言权吗?

Q2.我想从C++标准的角度理解,为什么标准强制执行编译器实现者不会有警告诊断?

#include <iostream>

class Base {
    public:
        virtual void Sayhi() { std::cout<<"hi from Base"<<std::endl; }
};

class Derived : public Base
{
    private:
        virtual void Sayhi() { std::cout<<"hi from Derived"<<std::endl; }
};


int main() {
    Base *pb = new Derived;
    // private method Derived::Sayhi() invoked.
    // May affect the object state!
    pb->Sayhi(); 
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ polymorphism standards access-specifier c++11

3
推荐指数
1
解决办法
412
查看次数

使用bitbakes在openEmbedded环境下部署Jenkins

是否有用户指南或标准做法,可帮助在openEmbedded环境中部署Jenkins?

我可以让jenkins服务运行,它使用SSH凭证从构建服务器上的普通SCM复制回购。buildserver是一台远程机器,到目前为止,我们一直使用Linux发行版(Fedora core 16)上的“ buildmaster”帐户来触发手动构建。在buildmaster下,我们用来修改bitbake配方并执行bitbake命令来构建目标映像(标准ipk映像)。

具体来说,我正在尝试找出使jenkins看到openEmbedded环境的正确方法。

我的计划是

1)在jenkins-home(/ var / log / jenkins)下创建一组OE目录,这些目录象征性地指向buildmaster bitbake目录结构。

2)在用户詹金斯中设置环境变量。

3)为用户“ jenkins”提供所有特权,以执行位于“ buildmaster”帐户中的脚本。

我在想正确的方向吗?另外,请建议使用任何合适的jenkins-plugin(如果有),这可能有助于在处理上述复杂性时设置Jenkins。

c++ continuous-integration jenkins openembedded bitbake

3
推荐指数
1
解决办法
3130
查看次数

数组衰变为Lambda中的指针

template<std::size_t size>
constexpr std::size_t arraySize(int const (&)[size])
{
    return size;
}

int main()
{
    auto const lambda = [](int const arr[]) -> void
    {
        std::cout << "The length of the array is: " << arraySize(arr) << std::endl;
    };

    lambda({1, 2, 3});

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

此代码提供以下输出:

main.cpp: In lambda function:
main.cpp:23:69: error: no matching function for call to 'arraySize(const int*&)'
         std::cout << "The length of the array is: " << arraySize(arr) << std::endl;
                                                                     ^
main.cpp:12:23: note: candidate: template<long long unsigned int …
Run Code Online (Sandbox Code Playgroud)

c++ arrays lambda c++11

3
推荐指数
1
解决办法
699
查看次数