undefined symbol: wurfl_ismobile

This is a discussion on undefined symbol: wurfl_ismobile within the C Programming forums, part of the General Programming Boards category; I am a beginner to C, and am doing a tutorial from the site: Mobile device detection with WURFL and ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    6

    Question undefined symbol: wurfl_ismobile

    I am a beginner to C, and am doing a tutorial from the site:
    Mobile device detection with WURFL and Varnish - Enrise

    I have a very simple setup at the moment, my vcl file consists of:
    Code:
    // Intialization
    C{
      #include "/home/retrobadger/working_files/tutorials/varnish_terawurfl_c/wurfl.h";
      int is_mobile;
    }C
    
    
    sub detectmobile {
      C{
        char *ua = "bam";
        is_mobile = wurfl_ismobile();
        //is_mobile = 1;
        VRT_SetHdr(sp, HDR_BEREQ, "\011X-Varnish-TeraWurfl:", (is_mobile == 1)?"yes":"no", vrt_magic_string_end);
      }C
    }
    But, when I go to restart varnish, I get an error such as:
    Code:
    undefined symbol: wurfl_ismobile
    Now, my function wurfl_ismobile is in a *.h and a *.c file as shown in the docs, although the *.c file is much simpler. Does anyone have a suggestion as to how I might start debugging this error message? I do not get an error message when I set the variable to 1, so I assume it's to do with the way I am requesting the function, or *.h file.

    Thanks for any advice you can give,
    Dan

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,047
    Quote Originally Posted by retrodans View Post
    Now, my function wurfl_ismobile is in a *.h and a *.c file as shown in the docs, although the *.c file is much simpler. Does anyone have a suggestion as to how I might start debugging this error message? I do not get an error message when I set the variable to 1, so I assume it's to do with the way I am requesting the function, or *.h file.

    Thanks for any advice you can give,
    Dan
    Is the "*.c" file containing wurfl_mobile() being included at compilation?

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    Yep, these are the 2 scripts I was told to use to compile:
    Code:
    gcc -c -o wurfl.o wurfl.c -I/usr/include/libxml2
    gcc -shared -Wl,-soname,libwurfl.so.1 -o libwurfl.so.1.0.1 wurfl.o -lxml2
    So after each change to my *.c or *.h file I run both those commands, although I suppose I only need to run them when the *.c file is changed. All my *.c file containes is:
    Code:
    #include <string.h>
    #include <libxml/parser.h>
    #include <libxml/tree.h>
    #include <libxml/xpath.h>
    #include <libxml/xpathInternals.h>
    #include "wurfl.h"
    
    int wurfl_ismobile() {
      return 1;
    }

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    2,489
    Quote Originally Posted by retrodans View Post
    Yep, these are the 2 scripts I was told to use to compile:
    Code:
    int wurfl_ismobile() {
      return 1;
    }
    Your function MOST likely needs to match what it expects to see. This is a guess what DOES your header contain?

    Try
    Code:
    int wurfl_ismobile(char *useragent){
      return 1;
    }
    Tim S.
    Last edited by stahta01; 03-30-2011 at 11:49 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21