我正在尝试使用MacOS X Mavericks中的标准C++(与XCode一起安装)中的线程运行一些代码.但是我遇到了一些错误.这是一个最小的工作示例:
#include <thread>
#include <iostream>
void run (int x) {
std::cout<<".";
}
int main (int argc, char const *argv[])
{
std::thread t(run);
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
minimal.cpp:10:17: error: no matching constructor for initialization of 'std::thread'
std::thread t(run,0);
^ ~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:372:9: note: candidate constructor template not viable: requires single argument '__f', but 2 arguments
were provided
thread::thread(_Fp __f)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:261:5: note: candidate constructor not viable: requires 1 argument, but 2 were provided
thread(const thread&);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:268:5: note: candidate constructor not viable: …Run Code Online (Sandbox Code Playgroud) 我只是注意到了这条线/etc/profile,我想知道这是什么意思,什么时候是真的.
if [ "${-#*i}" != "$-" ]; then
Run Code Online (Sandbox Code Playgroud)
i迭代几个*.sh文件.
很抱歉,如果这是一个愚蠢的问题,但你可以想象,在Google中寻找大多数符号实际上不是一个选择.
谢谢!
我试图os.mknod在 Windows 7 的 Python 3.5.0 中使用该函数,但是我发现了错误:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
os.mknod
AttributeError: module 'os' has no attribute 'mknod'
Run Code Online (Sandbox Code Playgroud)
我想它应该在那里,因为https://docs.python.org/3/library/os.html没有说明可用性有限。在 Windows 中是否有其他选项可用于类似功能?我只是想在特定路径中创建一个空文件,我认为调用open(path, 'w')有点难看。
我不知道这是否是版本特定的问题,因为我以前从未在 Windows 中使用过 Python。
问题基本上是,bash 如何处理双引号和括号?
我无法想出更好的例子,所以对此表示歉意,但想象一下这样的事情:
"$(echo "${foo}")"
那里会发生什么?技术上是否${foo}超出报价范围?bash 是否足够聪明,能够考虑它在括号内并从内向外工作?效果会\"${foo}\"更好吗?
我试过用谷歌搜索这个,但没有运气。请注意,这与嵌套引用问题不同,因为它包括扩展。
谢谢!