linux glib g_node_append_data_ compile error

Just starting out? Need help? Post your questions and find answers here.
dougmo52usr
User
User
Posts: 67
Joined: Mon Jul 18, 2016 6:43 pm

linux glib g_node_append_data_ compile error

Post by dougmo52usr »

The auto complete dropdown shows g_node_append_data_, and hitting tab inserts it in code, but the compiler fails saying g_node_append_data_ is not a function, array, list, map, or macro. g_node_new_ works. What am I missing to get access to glib functions code completion displays as present?
User avatar
mk-soft
Always Here
Always Here
Posts: 6233
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: linux glib g_node_append_data_ compile error

Post by mk-soft »

Import not work because is deprecated (or a macro)
What do you want to do?

Link: https://docs.gtk.org/glib/func.node_append_data.html

Code: Select all


ImportC ""
  g_node_append_data (parent, daten)
EndImport

;test
g_node_append_data(0,0)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6233
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: linux glib g_node_append_data_ compile error

Post by mk-soft »

Ok ...
It's a macro

You can also search for files content in linux file manager. Open to the folder "/usr/include" and search in it

Code: Select all

Macro g_node_append_data(parent, daten)
     g_node_insert_before_(parent, #Null, g_node_new_(daten))
EndMacro
;test
g_node_append_data(0,0)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
dougmo52usr
User
User
Posts: 67
Joined: Mon Jul 18, 2016 6:43 pm

Re: linux glib g_node_append_data_ compile error

Post by dougmo52usr »

Thanks for the help. I used your Macro g_node_append_data(parent, daten) example which works fine. However, I have a few questions.

I can use ImportC "/usr/lib/x86_64-linux-gnu/libglib-2.0.so", but ImportC "" doesn't compile on mine. Is there a project setting I need to use to specify location of libraries so that ImportC "" works for glib?

Are the declares for glib which are displayed in autocomplete available in a PB text file so I can study them? I see glib.imp but it is not text. I'd like to see how glib.imp is created and look at the source.
User avatar
mk-soft
Always Here
Always Here
Posts: 6233
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: linux glib g_node_append_data_ compile error

Post by mk-soft »

You only have to open the library file (.so) with OpenLibrary yourself in rare cases.
Most functions are fully implemented and sometimes with ImportC "" to define yourself.
Macros cannot be imported and must be written by yourself.

1. A so file cannot be imported but must be opened with OpenLibrary.
2. If a function is documented as a macro, you must write it yourself as a macro.
3. Specify standard libraries opened with OpenLibrary without a path. Paths and redirects are defined in the OS system.

OS functions already defined for PureBasic are listed in the file ../compilers/ApiFunctions.txt.
The IMP files are only a description of the API function with the parameters. They are not text files.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply