开发者

Netbeans C++ compile error: undefined reference to <function name>

I'm using Java native interface(JNI) to call upon a function from a c++ DLL. Bumped into this error of undefined reference to while compiling on the line of code where i instantiate BSSSystemUsageDataTable * x = new BSSSystemUsageDataTable(). I've already included all the required header files and lib files/paths. I'm not too sure what they are asking for because when i use x ->, all the function names in BSSSystemUsageDataTable.h shows up under netbeans. Any help is deeply appreciated. :) Thanks dudes.

#include <jni.h>                     
#include "PocWrapperNative.h"       
#include "BSSSystem开发者_StackOverflow社区UsageDataTable.h"
#include "inc/bssdevparam.h" /* Header of requried DLL */

using namespace BSSParameter;

JNIEXPORT jboolean JNICALL
Java_PocWrapper_decoding(JNIEnv *env, jobject obj, jstring s){

    const char* str;
    str = env -> GetStringUTFChars(s, 0);
    printf("From C++ %s", str);
    BSSSystemUsageDataTable * x = new BSSSystemUsageDataTable();  //**error code line**
    x ->decode(str, false);
    env->ReleaseStringUTFChars(s, str);
    return false;
}

Error Output:

build/Debug/MinGW_1-Windows/_ext/1106720024/PocCppNative.o: In function `Java_PocWrapper_decoding@12':
c:/Program Files/Java/jdk1.6.0_23/bin/PocCppNative/PocCppNative.cpp:49: undefined reference to `_imp___ZN12BSSParameter24CBSSSystemUsageDataTableC1Ev'
collect2: ld returned 1 exit status


The compiler doesn't find the definition of BSSSystemUsageDataTable. Although you've included a header file which seems to define this (possibly in corresponding .cpp file), I suspect that it's defined in a namespace which you forgot to mention in your code. Check it out if my suspicion is correct.

It also be possible that you've not included the implementation file in your build system. Or if there is any .lib which have the implementation, then possibly it's not added to the build system!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜