thread_cond_signal()未在范围中声明

时间:2012-11-25 11:22:06

标签: c++ multithreading compilation g++

我正在尝试使用thread_cond_signal()

编译程序

我的导入

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <queue>
#include <pthread.h>
#include <sys/timeb.h>
#include <map>
#include <fstream>
#include <algorithm>
#include <math.h>


#include <unistd.h>
#include <syslog.h>

#include "parser.h"
#include "safe_queue.h"
#include "priqueue.h"
#include "base64.h"
#include "xmlhelper.h"
#include "utils.h"
#include "messagehelper.h"
#include "default_config.h"
#include "main_process_helper.h"
#include "ExcludesParameters.h"
#include "eErrors.h"
#include "s_Error.h"
#include "eMessage_Type.h"
#include "hmaps.h"
#include "cookiestatus.h"
#include "sha1.h"
#include "ExcludeFields.h"
#include "pthreadStruct.h"

我的编译批处理脚本是

g++ -g -lpthread utils/hregex.cpp ExcludeFields.cpp utils/sha1.cpp utils/utils.cpp utils/base64.cpp utils/xmlhelper.cpp utils/messagehelper.cpp utils/safe_queue.cpp utils/parser.cpp utils/default_config.cpp ExcludesParameters.cpp main_process_helper.cpp main.cpp -Iutils -Ibusiness_objects -o telepath_sniff

输出:

‘thread_cond_signal’ was not declared in this scope

代码是:

thread_cond_signal( &cond_garbageQueue);

我还应该添加什么?它确实在Eclipse上编译

由于

2 个答案:

答案 0 :(得分:2)

您的意思是pthread_cond_signal()?

答案 1 :(得分:1)

pthread_cond_signal(&amp; cond)应该只需要-lpthread进行链接。 你能否提供一些关于错误的更多细节?