How to compile gcc-plugin to generate shared object file?

185 Views Asked by At

I have installed gcc-plugin in my Ubuntu 16.10-32 bit and the installation have been done correctly:

>$ gcc -print-file-name=plugin
/usr/lib/gcc/i686-linux-gnu/6/plugin

However, when I try to compile the plugin, I get a huge amount of errors, warning, and exceptions ... enter image description here

I can not understand what is the reason behind this. Is it a mistake in the compiling command line? or the installation of the gcc-plugin was not the right way?

I have compiled the gcc-plugin file as follow:

gcc -g -I`gcc -print-file-name=plugin`/include -fpic -shared -o my_plugin.so my_plugin.c

any help?

1

There are 1 best solutions below

0
hexcoder On

You have to use the C++ compiler g++. The command line looks otherwise ok, but I don't know your source code, of course.