c/c++ clang linking error on Mac OSX - webkitgtk -


i trying use gtk3 , webkitgtk. successful @ running following code :

#include <gtk/gtk.h> #include <webkit2/webkit2.h> #include <javascriptcore/javascript.h>  using namespace std;  static void destroywindowcb(gtkwidget* widget, gtkwidget* window); static gboolean closewebviewcb(webkitwebview* webview, gtkwidget* window);  int main(int argc, char* argv[]) { // initialize gtk+ gtk_init(&argc, &argv);  // create 800x600 window contain browser instance gtkwidget *main_window = gtk_window_new(gtk_window_toplevel); gtk_window_set_default_size(gtk_window(main_window), 800, 600);  // create browser instance webkitwebview *webview = webkit_web_view(webkit_web_view_new());  // put browser area main window gtk_container_add(gtk_container(main_window), gtk_widget(webview));  // set callbacks if either main window or browser instance // closed, program exit g_signal_connect(main_window, "destroy", g_callback(destroywindowcb), null); g_signal_connect(webview, "close", g_callback(closewebviewcb), main_window);  // load web page browser instance webkit_web_view_load_uri(webview, "http://www.webkitgtk.org/");  // make sure when browser area becomes visible, mouse // , keyboard events gtk_widget_grab_focus(gtk_widget(webview));  // make sure main window , contents visible gtk_widget_show_all(main_window);  // run main gtk+ event loop gtk_main();  return 0; }   static void destroywindowcb(gtkwidget* widget, gtkwidget* window) {     gtk_main_quit(); }  static gboolean closewebviewcb(webkitwebview* webview, gtkwidget* window) {     gtk_widget_destroy(window);     return true; } 

and following cmake list :

cmake_minimum_required(version 3.3) project(httpsmock)  # use package pkgconfig detect gtk+ headers/library files find_package(pkgconfig required)  pkg_check_modules(gtk3 required gtk+-3.0) pkg_check_modules(webkit required webkitgtk-3.0)  # setup cmake use gtk+, tell compiler headers include_directories(${gtk3_include_dirs}) include_directories(${webkit_include_dirs})  # , linker libraries link_directories(${gtk3_library_dirs}) link_directories(${webkit_library_dirs})  # add other flags compiler add_definitions(${gtk3_cflags_other}) add_definitions(${webkit_cflags_other})  # flags , source set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11 -v")  set(source_files main.cpp)  add_executable(httpsmock ${source_files}) # linking target_link_libraries(httpsmock ${gtk3_libraries}) target_link_libraries(httpsmock ${webkit_libraries}) 

but try use method :

webkiturirequest *request = webkit_uri_request_new("http://www.webkitgtk.org/"); 

the program doesn't want link anymore. it's weird. here's sample of error :

[100%] linking cxx executable httpsmock apple llvm version 7.0.0 (clang-700.0.72) target: x86_64-apple-darwin14.5.0 thread model: posix  "/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -syslibroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.11.sdk -o httpsmock -l/opt/local/lib -search_paths_first -headerpad_max_install_names cmakefiles/httpsmock.dir/main.cpp.o -lwebkitgtk-3.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpangoft2-1.0 -lpango-1.0 -lm -lfontconfig -lfreetype -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -ljavascriptcoregtk-3.0 -lglib-2.0 -lintl -rpath /opt/local/lib -lc++ -lsystem /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib/darwin/libclang_rt.osx.a undefined symbols architecture x86_64:   "_webkit_uri_request_new", referenced from:       _main in main.cpp.o ld: symbol(s) not found architecture x86_64 

i have no clue of going on. please enlighten me?

thanks

the problem using
pkg_check_modules(webkit required webkitgtk-3.0)
instead of
pkg_check_modules(webkit required webkit2gtk-3.0)


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -