Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ pthread在没有调用main的情况下链接失败_C++ - Fatal编程技术网

C++ pthread在没有调用main的情况下链接失败

C++ pthread在没有调用main的情况下链接失败,c++,C++,我一直在尝试使用angelscript,我不断收到链接器错误,但是如果我在主函数末尾引用pthread_exitNULL,它将正常构建、链接和运行 以下是相关代码: #include <iostream> #include <angelscript.h> #include <cassert> // This is used for AngelScript error messages void MessageCallback(const asSMessage

我一直在尝试使用angelscript,我不断收到链接器错误,但是如果我在主函数末尾引用pthread_exitNULL,它将正常构建、链接和运行

以下是相关代码:

#include <iostream>
#include <angelscript.h>
#include <cassert>

// This is used for AngelScript error messages
void MessageCallback(const asSMessageInfo &msg)
{
    const char *type = "ERR ";
    if( msg.type == asMSGTYPE_WARNING )
    {
        type = "WARN";
    }
    else if( msg.type == asMSGTYPE_INFORMATION )
    {
        type = "INFO";
    }

    std::cout << msg.section << " (" << msg.row << ", " << msg.col << ") : " << type << " : " << msg.message << std::endl;
}

int main(void)
{
    asIScriptEngine* engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);

    int r = engine->SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL);
    assert(r >= 0);

    std::cout << "Testing" << std::endl;

    engine->Release();
    pthread_exit(NULL);
    return 0;
}

有什么想法吗?

我已经将其缩小到-根据需要,看起来我将不得不从qmake中删除。无法识别的命令,我想知道它是否是GCC 4.9错误,因为如果我包括使用它的任何其他库,它编译得很好,例如:SDL。
g++ -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,-O1 -o fib main.o   -langelscript -lpthread