I am having a rather puzzling problem. Recently, whenever I compile a program using GCC or G++, the compiler creates a shared library rather than an executable file. The library still runs if I execute it via CLI, but the system still treats it as a shared library in all other aspects. I have tested this problem with multiple files, and have found that while it always happens with GCC or G++, it never happens with clang. Help is appreciated. Thanks!

closed as unclear what you're asking by Scott, dhag, thrig, mdpc, Gilles Mar 3 '17 at 23:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You say "the system still treats it as a shared library in all other aspects". What specifically do you notice it doing? – Joseph Sible Mar 3 '17 at 19:53
  • Is this on Linux? What does file say on your object files? Can we see the command line that your compiler is used with? – dhag Mar 3 '17 at 20:08
  • @JosephSible Namely, when I click on the file, it says "Could not display <program name>. There is no application installed for "shared library" files." – Techgineer Mar 3 '17 at 21:09
  • @dhag file outputs the following: test.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped. I compiled it with g++ -c test.cpp && g++ test.o -o test. – Techgineer Mar 3 '17 at 21:12
  • 1
    Can you confirm that the file has the execute bit set? If so, it seems like a bug in Nautilus (or whatever file manager you're using to try to open it), and not an issue with the compiler. – Joseph Sible Mar 3 '17 at 21:21

Browse other questions tagged or ask your own question.