CMake的版本做了我的code停止正常工作 [英] CMake Release made my code stop working properly

查看:269
本文介绍了CMake的版本做了我的code停止正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C ++程序时,我没有其他选项编译效果很好。但是,每当我使用cmake的-DCMAKE_BUILD_TYPE =松开还有就是code这停止工作的一个非常特殊的一部分。

I have a C++ program which works well when I compile with no additional options. However, whenever I use cmake -DCMAKE_BUILD_TYPE=Release there is a very specific part of the code which stops working.

具体而言,我有一个升压斐波那契堆的接口。我调用这个函数:

Concretely, I have an interface for a Boost Fibonacci Heap. I am calling this function:

narrow_band_.push(myObject的);

和这个函数执行以下操作:

And this function does the following:

inline void myHeap::push (myStruct & c) {
    handles_[c.getIndex()] = heap_.push(c);
}

其中heap_是:

boost::heap::fibonacci_heap<myStruct, boost::heap::compare<compare_func>> heap_;

有关某些原因heap_size不被修改,因此,code的其余部分不工作,因为下一步骤是提取从堆的最小和它总是空的。

For some reason the heap_size is not being modified, therefore the rest of the code does not work because the next step is to extract the minimum from the heap and it is always empty.

在调试模式下它工作正常。谢谢你的帮助。

In Debug mode it works ok. Thank you for your help.

编辑 - 附加信息
我也发现了这个问题:我有一组code里面做简单的数学运算。在释放模式的结果是不正确的。如果我只是做COUT几个变量来检查他们的价值观,结果被更改,这仍是不正确,但很奇怪。

EDIT - Additional info I have also found this problem: I have a set of code which do simple math operations. In Release mode the results are incorrect. If I just do cout of a couple of variables to check their values, the result changes, which is still incorrect but quite strange.

推荐答案

我解决了这个问题。这是有趣的,但在这种情况下它没有被初始化/定时在释放模式的常见问题。这是return语句在一对夫妇的功能缺失。在调试模式下,输出是完美的,但失败的释放模式。我曾警告无效,这就是为什么我没有看到过它。

I solved the problem. It was funny but in this case it was not initialization/timing issues common in the Release mode. It was that the return statement was missing in a couple of functions. In debug mode the output was perfect but in the release mode that failed. I had warnings deactivated, that is why I did not see it before.

这篇关于CMake的版本做了我的code停止正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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