Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.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/regex/20.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
G++;从正则表达式系统头找不到符号 我试图在我的C++项目中使用GNU C库正则表达式功能,特别是我尝试使用ReXEXT ReGCOMP,ReExcel,ReGiFor函数。编译时,我收到错误,指出这些符号未定义: me> g++ -I/me/myheaders/ -c RootGenerator.cpp -o RootGenerator.o -std=gnu++0x -Wall RootGenerator.cpp: In function ‘std::string findFirstFileInCurrentDirectory(std::string)’: RootGenerator.cpp:1072: error: ‘regex_t’ was not declared in this scope RootGenerator.cpp:1072: error: expected ‘;’ before ‘re’ RootGenerator.cpp:1073: error: ‘re’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_EXTENDED’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_NOSUB’ was not declared in this scope RootGenerator.cpp:1073: error: ‘regcomp’ was not declared in this scope RootGenerator.cpp:1074: error: expected ‘;’ before ‘int’ RootGenerator.cpp:1084: error: ‘status’ was not declared in this scope RootGenerator.cpp:1084: error: ‘regexec’ was not declared in this scope RootGenerator.cpp:1092: error: ‘REG_NOMATCH’ was not declared in this scope RootGenerator.cpp:1108: error: ‘regfree’ was not declared in this scope_C++_Regex_Gcc_G++ - Fatal编程技术网

G++;从正则表达式系统头找不到符号 我试图在我的C++项目中使用GNU C库正则表达式功能,特别是我尝试使用ReXEXT ReGCOMP,ReExcel,ReGiFor函数。编译时,我收到错误,指出这些符号未定义: me> g++ -I/me/myheaders/ -c RootGenerator.cpp -o RootGenerator.o -std=gnu++0x -Wall RootGenerator.cpp: In function ‘std::string findFirstFileInCurrentDirectory(std::string)’: RootGenerator.cpp:1072: error: ‘regex_t’ was not declared in this scope RootGenerator.cpp:1072: error: expected ‘;’ before ‘re’ RootGenerator.cpp:1073: error: ‘re’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_EXTENDED’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_NOSUB’ was not declared in this scope RootGenerator.cpp:1073: error: ‘regcomp’ was not declared in this scope RootGenerator.cpp:1074: error: expected ‘;’ before ‘int’ RootGenerator.cpp:1084: error: ‘status’ was not declared in this scope RootGenerator.cpp:1084: error: ‘regexec’ was not declared in this scope RootGenerator.cpp:1092: error: ‘REG_NOMATCH’ was not declared in this scope RootGenerator.cpp:1108: error: ‘regfree’ was not declared in this scope

G++;从正则表达式系统头找不到符号 我试图在我的C++项目中使用GNU C库正则表达式功能,特别是我尝试使用ReXEXT ReGCOMP,ReExcel,ReGiFor函数。编译时,我收到错误,指出这些符号未定义: me> g++ -I/me/myheaders/ -c RootGenerator.cpp -o RootGenerator.o -std=gnu++0x -Wall RootGenerator.cpp: In function ‘std::string findFirstFileInCurrentDirectory(std::string)’: RootGenerator.cpp:1072: error: ‘regex_t’ was not declared in this scope RootGenerator.cpp:1072: error: expected ‘;’ before ‘re’ RootGenerator.cpp:1073: error: ‘re’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_EXTENDED’ was not declared in this scope RootGenerator.cpp:1073: error: ‘REG_NOSUB’ was not declared in this scope RootGenerator.cpp:1073: error: ‘regcomp’ was not declared in this scope RootGenerator.cpp:1074: error: expected ‘;’ before ‘int’ RootGenerator.cpp:1084: error: ‘status’ was not declared in this scope RootGenerator.cpp:1084: error: ‘regexec’ was not declared in this scope RootGenerator.cpp:1092: error: ‘REG_NOMATCH’ was not declared in this scope RootGenerator.cpp:1108: error: ‘regfree’ was not declared in this scope,c++,regex,gcc,g++,C++,Regex,Gcc,G++,我意识到regex头是一个TR1实现,因此对于我的GCC版本来说是实验性的。根据首次尝试编译时收到的编译器警告,我添加了-std=gnu++0x编译器选项,但这似乎无法解决问题。这是否是系统无法识别并向“实验”头添加路径的问题?是否需要指定其他包含路径或编译器选项 另外,我在Eclipse/CDT中注意到,在ProjectExplorer视图的“includes”选项卡下,它显示了一个系统头路径列表。它在/user/include/c++/4.4.4路径选项卡下列出了许多头文件,但没有列出reg

我意识到regex头是一个TR1实现,因此对于我的GCC版本来说是实验性的。根据首次尝试编译时收到的编译器警告,我添加了
-std=gnu++0x
编译器选项,但这似乎无法解决问题。这是否是系统无法识别并向“实验”头添加路径的问题?是否需要指定其他包含路径或编译器选项

另外,我在Eclipse/CDT中注意到,在ProjectExplorer视图的“includes”选项卡下,它显示了一个系统头路径列表。它在/user/include/c++/4.4.4路径选项卡下列出了许多头文件,但没有列出regex头文件。我认为这也再次证明了存在设置问题。

发现了问题:

#include <regex>
#包括
应该是

#include <regex.h>
#包括

regex.h
头是regex的GNU C库实现,包含我在源代码中尝试使用的函数。
regex
头是TR1(且不完整)regex实现。所以@Oli,我毕竟没有引用相关的标题

只是一次精神检查;你的源文件肯定包含了相关的头文件?当涉及到regex时,有很多东西丢失了>是的,GCC还没有实现
。哈哈,是的,GCC 4.4.4非常旧。不幸的是,我的公司有严格的IT要求,并且遵循RHEL分发更改生命周期。它们实际上不允许我们进行太多的自定义。错误中没有一个符号是名称空间限定的-您的代码中有合适的“使用名称空间tr1”吗?