对库中函数的未定义引用

时间:2013-10-23 10:00:56

标签: c++ libtool ccxml

我正在尝试运行Oktopous CCXML来测试CCXML执行。我有从libtoptop网站下载的liboktopous 32位库。 liboktopous.so

的文件信息
liboktopous.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

liboktopous.so上的nm -D输出为here。包含文件是

#ifndef _OKTOINTERPRETER_H_
#define _OKTOINTERPRETER_H_

#include <OktoDefs.hpp>
#include <string>


typedef std::basic_string<VXIchar> vxistring ;

class OktoLog;
class OktoPlatform;
class OktoInet;
class OutputQueue;
class OktoScript;


/**
 * Interface for interacting with the CCXML interpreter. 
 *
 * \ingroup Platform
 */
class OKTO_API OktoInterpreter 
{
    public:
        /** OktoInterpreter Result */

        enum Result {
            /** Fatal error, terminate call    */
            RESULT_FATAL_ERROR          = -100, 
            /** Out of memory                  */
            RESULT_OUT_OF_MEMORY        =   -6, 
            /** System error, out of service   */
            RESULT_SYSTEM_ERROR         =   -5, 
            /** Property name is not valid     */
            RESULT_INVALID_PROP_NAME    =   -3, 
            /** Property value is not valid    */
            RESULT_INVALID_PROP_VALUE   =   -2, 
            /** Invalid function argument      */
            RESULT_INVALID_ARGUMENT     =   -1, 
            /** Success                        */
            RESULT_SUCCESS              =    0,
            /** Normal failure, nothing logged */
            RESULT_FAILURE              =    1,
            /** Non-fatal non-specific error   */
            RESULT_NON_FATAL_ERROR      =    2, 
            /** Document not found             */
            RESULT_NOT_FOUND            =   50, 
            /** Other document fetch error     */
            RESULT_FETCH_ERROR          =   52,
            /** Not a valid CCXML document     */
            RESULT_INVALID_DOCUMENT     =   53, 
            /** Uncaught fatal VoiceXML event  */
            RESULT_UNCAUGHT_FATAL_EVENT =   55,
            /** ECMAScript syntax error        */
            RESULT_SCRIPT_ERROR         =   56,
            /** Not runnning                   */
            RESULT_NOT_RUNNING          =   57,
            /** Operation is not supported     */
            RESULT_UNSUPPORTED          =  100
        };

        enum EventThreadPolicy {
            POLICY_DEFAULT,
            POLICY_POOLED
        };
        /** 
         * Resources used by the interpreter when run. 
         * \ingroup Platform
         */
        struct Resources {
            /** log interface */
            OktoLog              * log;
            /** ECMAScript interface */
            OktoScript           * jsi;    
            /** Internet interface */
            OktoInet             * inet; 
            /** Platform interface */
            OktoPlatform         * platform; 
        };

    public:
        /**
         * One time initializtion of the interpreter.<p>
         * This function should be called once at platform startup.<p>
         *
         * @param log         Pointer to a log object.  This method does not retain
         *                    this object, rather uses it for the length of the
         *                    method call.
         * @param diagLogBase Base dialog ID.
         * @param output      [OUT] A pointer the to the output queue the platform
         *                    will receives commands from.  The platform should
         *                    create at least one thread to processes commands on.
         *
         * @return true if initialization is successful.
         */
        //static bool Initialize(OktoLog * log, VXIunsigned diagLogBase, OutputQueue **output, EventThreadPolicy policy);
        static bool Initialize(OktoLog * log,OutputQueue **output, EventThreadPolicy policy);

        /**
         * One time shutdown of the interpreter.
         *
         * @param log         Pointer to a log object.  This method does not retain
         *                    this object, rather uses it for the length of the
         *                    method call.
         * @param output      Pointer to the outout queue received from the call
         *                    to Initialize.
         */
        static void Deinitialize(OutputQueue *output );

        /**
         * Creates an instance of an interpreter.
         */
        static OktoInterpreter *CreateInstance();


        /**
         * Destroys an instance of an interpreter.
         */
        static void DestroyInstance( OktoInterpreter *interp );

        /**
         * Starts CCXML interpretation of the specified script.
         *
         * @param initialURI   [IN]  The URI of the starting CCXML doc.
         * @param args         [IN]  Option properties that affect interpreter
         *                           behavior: None now.
         * @param resources    [IN]  Resources supplied by the platform.
         *
         * @return: RESULT_FATAL_ERROR<br>
         *          RESULT_OUT_OF_MEMORY<br>
         *          RESULT_SUCCESS<br>
         *          RESULT_INVALID_ARGUMENT<br>
         *          RESULT_INVALID_DOCUMENT<br>
         */
        virtual Result Run(
                const VXIchar  * initialURI, 
                const VXIchar  * csessionid,
                const VXIchar  * fetchid,
                        const VXIMap    * fetchProperties, //Added this to send fetch props to fetcher
                const VXIMap   * args,
                Resources      * resources ) = 0;

        /**
         * Add an event to the event queue.
         *
         * @param event  [IN] The event to post.  If successful, the 
         *                    interpreter owns the VXIMap, otherwise
         *                    the caller is responsible for destroying
         *                    it.
         * @param delay  [IN] The delay, in milliseconds before the
         *                    event is processed.
         * 
         * @return  RESULT_SUCCESS<br>
         *          RESULT_NOT_RUNNING<br>
         *          RESULT_INVALID_ARGUMENT<br>
         */
        virtual Result PostEvent( VXIMap *event, VXIunsigned delay ) = 0;

        virtual bool CancelEvent(vxistring&  sendid) =0;
        //saurabh 2011 added for fetch testing,remove it if you still have it
        virtual OktoInet* returnInetResource()=0;
};

#endif

现在,当我尝试编译

#include "/home/test/ccxml.back/oktopous/include/OktoInterpreter.hpp"

int main()
{
        OutputQueue *outQ;
        OktoInterpreter::Initialize(NULL,&outQ,OktoInterpreter::POLICY_DEFAULT);
        OktoInterpreter::Deinitialize(outQ);
}
使用

g++ -m32  -I/home/test/ccxml.back/oktopous/include -L/home/test/ccxml.back/oktopous/lib/liboktopous.so ../wrapper/test.cpp

我得到了

/tmp/ccsJNUJi.o: In function `main':
test.cpp:(.text+0x21): undefined reference to `OktoInterpreter::Initialize(OktoLog*, OutputQueue**, OktoInterpreter::EventThreadPolicy)'
test.cpp:(.text+0x2d): undefined reference to `OktoInterpreter::Deinitialize(OutputQueue*)'
collect2: ld returned 1 exit status

我做错了什么?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。我认为使用-m32标志将允许我在64位机器中使用32位库。但事实并非如此。我把我的代码移植到32位机器上,然后就解决了。