Может ли кто-нибудь помочь мне с этой проблемой? Я пытаюсь запустить приложение, используя cmakefiles. в основном файле моей программы я получаю ошибку сегментации, когда программа попадает в строку кода для выполнения QAppication. Вот фрагмент кода ниже:Сегментация выполнения программы QApplication
int main(int argc, char** argv)
{
bool viewing;
parse_command_line(argc, argv);
#ifdef _GRAPHICS_
glutInit(&argc, argv); // note the code runs correctly when this line is excluded and the glutInit was initialized in another class named Viewer (See class Viewer instantiated below), however for my specific application I need to initialize the glutInit in the main program
#endif
if(viewing)
{
#ifdef _GRAPHICS_
QApplication application(argc, argv);
Viewer *viewer = new Viewer(0, exp, argc, argv);
Interface *render = new Interface(0, exp, viewer);
render->show();
return application.exec(); //this line causes the segmentation fault
delete viewer;
delete render;
#endif
}
}
Если вы уменьшите main до только 'glutInit (& argc, argv);' он все еще падает? – drescherjm
Что касается этой аналогичной проблемы [Ошибка сегментации QApplication] (http://stackoverflow.com/questions/14685425/qapplication-segmentation-fault?rq=1)? –
Линии после 'return' никогда не будут выполнены! – Evgeny