vala - undefined reference to `soup_session_new' -
i trying make request in vala following this: https://wiki.gnome.org/vala/libsoupsample. says , compiler throws this:
connection.vala.c:(.text+0x76): undefined reference `soup_session_new' collect2: ld returned 1 exit status error: cc exited status 256 compilation failed: 1 error(s), 0 warning(s)
and result pkg-config --libs --cflags libsoup-2.4
-pthread -i/usr/include/libsoup-2.4 -i/usr/include/libxml2 -i/usr/include/glib-2.0 -i/usr/lib/x86_64-linux-gnu/glib-2.0/include -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -lglib-2.0
i have vala 0.20.1. runing on elementaryos (the newest stable version). ideas?
i had same issue earlier today. seems example out of date. it's no longer called soup_session_new
, reference soup_session_sync_new
. use new soup.sessionsync ()
, should work.
here's working example:
using soup; int main (string[] args) { string url = "http://google.com"; stdout.printf ("getting data %s\n", url); var session = new soup.sessionsync (); var message = new soup.message ("get", url); session.send_message (message); stdout.write (message.response_body.data); return 0; }