编译 zthreads
我下载了 zthreads(在这里找到:http://zthread.sourceforge.net/)并尝试编译,但是我从 make 中得到此错误:
MutexImpl.h:156: error: there are no arguments to 'ownerAcquired' that depend on a template parameter, so a declaration of 'ownerAcquired' must be available
MutexImpl.h:156: error: (如果您使用 '-fpermissive',G++ 将接受您的代码,但不推荐使用未声明的名称),
然后对于其中的每个函数源文件我收到这种错误:
MutexImpl.h:167: error: there are no arguments to 'function' that depend on a template parameter, so a declaration of 'function' must be available
所以我猜测这是一个 makefile 错误,但我不确定如何告诉 make 告诉 g++ 使用 -fpermissive 编译文件。 有谁知道如何将其放入 makefile 中(如果这是问题)?
I downloaded zthreads (found here: http://zthread.sourceforge.net/) and tried to compile but I get this error from make:
MutexImpl.h:156: error: there are no arguments to 'ownerAcquired' that depend on a template parameter, so a declaration of 'ownerAcquired' must be available
MutexImpl.h:156: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
and then after that for every function in that source file I get this kind of error:
MutexImpl.h:167: error: there are no arguments to 'function' that depend on a template parameter, so a declaration of 'function' must be available
So I'm guessing it's a makefile error but I'm not for sure how to tell make to tell g++ to compile the files with -fpermissive. Does anyone know how to put that into the makefile (if that is the problem)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CXXFLAGS += -fpermissive
CXXFLAGS += -fpermissive
标准 gmake 约定是使用 CXXFLAGS 变量将选项传递给 C++ 编译器。 您可以利用这一事实以及称为“命令行覆盖”的功能,通过以下方式调用 gmake 将额外的标志附加到传递给 g++ 的标志上:
我自己下载了源代码以验证其是否有效,并发现确实如此,尽管仍然发出了许多其他警告。 如果您打算继续使用该库,您可能希望记录这些问题的错误。
希望这有帮助,
埃里克·梅尔斯基
Standard gmake convention is to use the
CXXFLAGS
variable to pass options to the C++ compiler. You can take advantage of that fact as well as a feature called "command-line overrides" to get your extra flag tacked onto the flags passed to g++ by invoking gmake this way:I downloaded the source myself to verify that this works and found that it does, although there are still a bunch of other warnings emitted. You may wish to log a bug for these issues if you intend to continue using the library.
Hope this helps,
Eric Melski
我通过更改代码消除了所有这些错误:对于存在该错误的每一行,添加此-> 到引起错误的函数。 在您引用的行中:
ownerAcquired 必须更改为 this->ownerAcquired
我希望这有帮助
I got rid of all these errors changing the code: for each line with that mistake, add this-> to the function that provokes the error. In the line you quote:
ownerAcquired must be changed by this->ownerAcquired
I hope this helps