Hey there,

I am attempting to open Firefox using C++ on Linux (Ubuntu). However, I get an segmentation fault. What am I doing wrong, and what should I do?

std::cout << system("/usr/bin/firefox") << std::endl;

/usr/bin/firefox works in commandline and when I run this program in debug mode in Netbeans, firefox starts like it should.

I hope to hear from you.

Kind regards,


try running that system function on a line all by itself.


Gives the same result.

I'm sure this is not helpful, but as a data point for you this runs fine for me.

#include <iostream>
#include <cstdio>
#include <cstdlib>

int main()
  return 0;


Alright, thank you very much. Strangely enough, running the code with netbeans in execution mode gets me a Segmentation Fault, but if I build it and then run it, it works fine.

Anyone got a clue how this is possible? Or perhaps suggestion what IDE I should use instead?