简体   繁体   English

regex_replace在Windows上不起作用

[英]regex_replace doesn't work on Windows

I made a program on Linux, but now I want to make it compatible with Windows. 我在Linux上编写了一个程序,但现在我想使其与Windows兼容。 So I compiled my libraries in Windows, created a Code::Blocks project, and starting adapting some functions and variables that don't suit to Windows. 因此,我在Windows中编译了我的库,创建了Code :: Blocks项目,并开始调整一些不适合Windows的函数和变量。

But there is a function that I don't understand why it doesn't work, regex_replace(). 但是有一个我不明白为什么它不起作用的函数,regex_replace()。 #include doesn't give an error, and regex_match neither. #include不会给出错误,regex_match也不会。 Here is my function: 这是我的功能:

string str = "hey guys";
str = regex_replace(string str, regex("guys"), "girls");

And 'str' is now "hey girls". 而“ str”现在是“嘿女孩”。

But when I compile on Windows, it gives me this error: "no matching function for call to 'regex_replace'". 但是,当我在Windows上编译时,它给了我这个错误:“没有匹配的函数来调用'regex_replace'”。 I searched a little bit, but I didn't find anything interesting. 我搜索了一下,但没有发现任何有趣的东西。

So what should I do? 所以我该怎么做? Thank you! 谢谢!

That's a code problem, not a windows problem. 那是代码问题,而不是Windows问题。 Your code compiles neither on Linux, nor on Windows: 您的代码无法在Linux或Windows上编译:

str = regex_replace(string str, regex("guys"), "girls");
                    ^^^^^^
                    not allowed there

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM