请教cygwin下用gdb调试代码的问题
下面这段代码编译和运行阶段都没有报错,但是使用gdb,在main函数前面设一个断点,run,再next就会报错,错误信息是
Program received signal SIGSEGV, Segmentation fault.
0x610ae938 in pthread_key_create () from /usr/bin/cygwin1.dll
源代码是:
#include <iostream>
using namespace std;
template <int v>
struct int2type
{
enum {value = v};
};
template <typename T, bool isPolymorphic>
class NiftyContainer
{
private:
void DoSomething(T* obj, int2type <true> ) {
cout < < "True " < <endl;
}
void DoSomething(T* obj, int2type <false> ) {
cout < < "False " < < endl;
}
public:
void DoSomething(T* pObj) {
DoSomething(pObj, int2type <isPolymorphic> ());
}
};
int main(void)
{
int i = 5;
int* pi = &i;
NiftyContainer <int, true> obj;
obj.DoSomething(pi);
}
------解决方案--------------------> 在main函数前面设一个断点
具体在什么位置?
我在linux下没问题,没有手边cygwin,没法试