小编Jim*_*Jim的帖子

使用Eclipse和minGW的多个"无法解决"问题

我最近安装了(最新版本的)'Eclipse IDE for C/C++ Developers'和minGW(4.8.1),以帮助我在很长一段时间后重新使用C++.

我已经加入-std=c++11Other flagsC/C++ Build/Settings/Tool Settings/GCC C++ Compiler/Miscellaneous

我有一个小程序,利用了许多C++ 11特性(例如使用chrono.emplace_back).

运行后,我在Problems窗口中遇到多个未解决的问题,如下面的粘贴).

有趣的是,该程序确实编译并运行正常.

  1. 有了这个,我有没有在Eclipse中设置解决这些问题的东西?

  2. 有没有人知道to_string()minGW(4.8.1)中的函数是否仍有问题,例如以下内容无法编译:

    window.setTitle("Bullets on screen: " + to_string(bullets.size()) + " currentSlice: " + to_string(currentSlice) + " FT: " + to_string(ft) + " FPS: " + to_string(fps) );
    
    Run Code Online (Sandbox Code Playgroud)

    它使用Visual Studio Express 2013进行编译(尽管它存在chrono库的准确性问题,因此切换到minGW).

    谢谢.

Eclipse'问题'窗口输出:

Description Resource Path Location Type
 Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 19 Semantic Error
 Function 'now' …
Run Code Online (Sandbox Code Playgroud)

c++ eclipse gcc mingw32 c++11

16
推荐指数
2
解决办法
6万
查看次数

奇怪的行为使用chrono :: high_resolution_clock :: now()

我一直在研究各种游戏计时循环方法,例如Glenn Fiedler和DeWitter.由于我自己的C++知识限制,我发现关键领域难以理解.有了这个我开始尝试实现我自己的方法....我想一个好方法来尝试理解这些方法的一些东西.

[edit1:我正在使用CodeBlocks IDE和minGW-w64(x64-4.8.1-posix-seh-rev5)作为编译器]

[edit2:修改代码和输出窗口以包含第3个计时器,QueryPerformanceCounter]

在尝试完成此操作时,我遇到了以下问题:

最小代码:

#include <chrono>
#include <iostream>
#include <windows.h>
#include <stdio.h>

using namespace std;
using namespace chrono;

LARGE_INTEGER startqpc, stopqpc, li;
double PCFreq = 0.0;


void print()
{
for (int p=0; p<1000000; ) p += 1;  //adjust till ms (steady) returns 1-2ms
}

int main()
{
    for(int x=0; x<200; x += 1)
    {
    steady_clock::time_point start = steady_clock::now();
    auto timePoint1 = chrono::high_resolution_clock::now();

    if(!QueryPerformanceFrequency(&li))
        cout << "QueryPerformanceFrequency failed!\n";
    PCFreq = double(li.QuadPart)/1000.0;
    QueryPerformanceCounter(&startqpc);

    print();

    steady_clock::time_point finish = steady_clock::now();
    auto …
Run Code Online (Sandbox Code Playgroud)

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

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

标签 统计

c++ ×2

c++11 ×2

c++-chrono ×1

eclipse ×1

gcc ×1

mingw32 ×1