GTKmm segmentation fault when calling other function with void*argument
Hi there,
Now, I have to say that I have no clue what's happening here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include "window.h"
#include <gtkmm/main.h>
void itseikkunatesti()
{
int argcc;
char* *argvv;
Gtk::Main ikk(argcc,argvv);
Window window;
ikk.run(window);
}
void* itseikkuna(void* argumentti)
{
}
int main(int argc, char *argv[])
{
itseikkuna(NULL);
itseikkunatesti();
}
|
If I compile this, with (window.o, indeksi.o, tiedosto.o didn't change and work)
1 2
|
g++ main.cc -c `pkg-config --cflags --libs gtkmm-2.4` -pthread
g++ main.o indeksi.o window.o tiedosto.o `pkg-config --cflags --libs gtkmm-2.4` -pthread
|
I get a segmentation fault. Now, if I take the line of "itseikkuna(NULL)" out of there, everything work fine.
What am I missing? I have no clue.
The reason for need of void * function(void * argument) is due to using pthreads. pthreads.create need functions like that.
All help is truly appreciated!
The error is actually in line 8, where you pass argcc and argvv to the constructor, even though they're both uninitialized.
thanks, works now! Just passed the main arguments on to the function.
Any idea why it did work "wrong"?
Topic archived. No new replies allowed.