geany / geany-plugins

The combined Geany Plugins collection
http://plugins.geany.org/
590 stars 264 forks source link

help with plugin writing docs #1357

Closed BMaxV closed 3 months ago

BMaxV commented 3 months ago

Hello everyone,

I'm trying to follow the instructions here.

https://www.geany.org/manual/reference/howto.html

But I'm a bit stuck on the files that are required, starting with the geanyplugin.h and where to put them and how to put them there.

I have geany installed with apt, but the headers are not in the include path of gcc, so I looked up which locations that would be and copied just the geanyplugin.h to that location. Now I'm having the same problem with all the headers mentioned in the geanyplugin.h. Copying those manually can't be the right approach, right?

I have not used C in a long time, so if this seems like a simple/obvious question, I apologize, but I would welcome a tip for where to read up on these kinds of issues.

Also if you have a different, preferred communications channel like matrix, irc or discord, please let me know.

Thanks!

elextr commented 3 months ago

You don't say which distro, remember distros make their own packages not us, for eg Debian (and derivatives) have a geany-common package that has the needed include files (in /usr/include/geany on this machine, but YMMV).

Then the pkg-config ... part of the commands in the "Building" section should set the -I options for C to find them.

BMaxV commented 3 months ago

Ok, so I'm on ubuntu 22.04 and /usr/include/geany/ exists.

If I try this command:

gcc -c plugin.c -fPIC `pkg-config --cflags geany -I /usr/include/geany/`

I get this error:

gcc: error: unrecognized command-line option ‘--cflags’

if I remove that, I get this:

gcc -c plugin.c -fPIC `pkg-config -I /usr/include/geany

cc1: fatal error: plugin.c: No such file or directory
compilation terminated.

But the directory definitely exists.

My gcc version is gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 if that makes a difference

elextr commented 3 months ago

Please use exactly the commands given in the Geany plugin howto "Building" section, do not add stuff to the command, and then post errors if it does not work.

Make sure your plugin file is plugin.c and you execute the commands in that directory.

BMaxV commented 3 months ago

Ok. Exactly that command and exactly that file name produce this:

> gcc -c plugin.c -fPIC `pkg-config --cflags geany` 
gcc: error: unrecognized command-line option ‘--cflags’

Ah, ok, you have to use bash, not fish.

BMaxV commented 3 months ago

Ok, that step worked, I will see what I can do now! Thanks for the help!