c++初学者这个错误怎么改啊

bgw/packages/MNbridge/MNbridge.cpp: In function 'int createToRildFd()':
bgw/packages/MNbridge/MNbridge.cpp:33:40: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
bgw/packages/MNbridge/MNbridge.cpp: In function 'sendAtErrnoType setupToRild()':
bgw/packages/MNbridge/MNbridge.cpp:53:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
bgw/packages/MNbridge/MNbridge.cpp: In function 'int main(int, char**)':
bgw/packages/MNbridge/MNbridge.cpp:163:60: warning: 'pRadio' is used uninitialized in this function [-Wuninitialized]
bgw/packages/MNbridge/MNbridge.cpp:167:22: warning: 'Q' is used uninitialized in this function [-Wuninitialized]
target thumb C++: MNbridge <= bgw/packages/MNbridge/receive.cpp
bgw/packages/MNbridge/receive.cpp: In function 'void receive_loop()':
bgw/packages/MNbridge/receive.cpp:51:40: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
bgw/packages/MNbridge/receive.cpp: In function 'android::byte* receive_message(int)':
bgw/packages/MNbridge/receive.cpp:72:32: warning: 'recvBuffer' is used uninitialized in this function [-Wuninitialized]
In file included from bgw/packages/MNbridge/receive.cpp:10:0:
bgw/packages/MNbridge/receive.h: At global scope:
bgw/packages/MNbridge/receive.h:10:13: warning: 'void android::receive_loop()' used but never defined [enabled by default]
target Executable: MNbridge (out/target/product/mf662c_512/obj/EXECUTABLES/MNbridge_intermediates/LINKED/MNbridge)
bgw/packages/MNbridge/MNbridge.cpp:188: error: undefined reference to 'android::thread_receive(void*)'
collect2: error: ld returned 1 exit status
make: *** [out/target/product/mf662c_512/obj/EXECUTABLES/MNbridge_intermediates/LINKED/MNbridge] 错误 1
make:离开目录“/home/gss/code/8909”

3个回答

在你的代码里并没有发现函数thread_receive的定义啊

shihengzhen101
AlbertS 你新建个工程试试吧,怎么main函数都没了
3 年多之前 回复
gu18724001186
奋斗不懈二哈猿 已经解决了,是我的namespace android包含的方式不正确,不过又出现了新问题,out/target/product/mf662c_512/obj/lib/crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to 'main'
3 年多之前 回复

我的定义了这个函数,也包含了相关的头文件,不知道为什么还是会出错

int main(int argc, char **argv)
{
LinkQueue Q;
pthread_t tid_receive;

    atRadioEvent *pRadio;
    RadioState pRadioState;
    pRadioState = RADIO_ON;

    sendAtFd fd = createToRildFd();

    sendAtErrnoType flag = setupToRild();

    pRadio->ril_request_radio = RIL_REQUEST_RADIO_POWER;
    pRadio->serial = ++variableserial;
    pRadio->on = pRadioState;

    init_queue(Q);
    int result = pthread_create(&tid_receive, NULL,thread_receive, NULL);
            if(result != 0)
            {
                    printf("Failed to create a new thread(receive)");
                    exit(0);
            }
    pthread_detach(tid_receive);
    send_at_fight_mode(pRadio);

    //²»ÄÜÁ¢¼´½áÊø³ÌÐò£¬·ñÔòÔì³ÉECONNRESET 104´íÎó connection reset by peer
    //sleepµÄ¾«¶ÈÊÇÃë,usleepµÄ¾«¶ÈÊÇ΢Ãî
    sleep(3);

    //»òÕß²»ÈóÌÐòÍ˳ö£¬½øÈëËÀÑ­»·
    while(0) {
        // sleep(UINT32_MAX) seems to return immediately on bionic
        sleep(0x00ffffff);

    }
    return 0;

}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问