编译 zthreads

发布于 2024-07-17 02:01:50 字数 735 浏览 7 评论 0原文

我下载了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

熊抱啵儿 2024-07-24 02:01:50

CXXFLAGS += -fpermissive

CXXFLAGS += -fpermissive

早乙女 2024-07-24 02:01:50

标准 gmake 约定是使用 CXXFLAGS 变量将选项传递给 C++ 编译器。 您可以利用这一事实以及称为“命令行覆盖”的功能,通过以下方式调用 gmake 将额外的标志附加到传递给 g++ 的标志上:

make CXXFLAGS+=-fpermissive

我自己下载了源代码以验证其是否有效,并发现确实如此,尽管仍然发出了许多其他警告。 如果您打算继续使用该库,您可能希望记录这些问题的错误。

希望这有帮助,

埃里克·梅尔斯基

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:

make CXXFLAGS+=-fpermissive

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

执妄 2024-07-24 02:01:50

我通过更改代码消除了所有这些错误:对于存在该错误的每一行,添加此-> 到引起错误的函数。 在您引用的行中:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文