如何在代码块上添加编译器标志 [英] How to add compiler flags on codeblocks

查看:166
本文介绍了如何在代码块上添加编译器标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力编译一个简单的多线程代码片段,我试图在线学习如何多线程。

要运行这段代码,我需要使用编译器标志: -pthread -std = c ++ 0x

但是每当我尝试添加标记生成日志不显示他们正在使用。



我已经尝试了一些在线通用技巧来让这些工作起作用,但没有一个能够工作。有人可以帮忙吗?

我试过其他的建议,在代码块中添加编译器标志,但是当我这样做并检查构建日志时,它们都没有出现。 / p>

解决方案

因为这个问题被标记为重复,即使不需要处理它,因为有关于链接器标志,这里是关于编译器标志,我将发布我的答案在这里。



您必须转到设置 - > 编译器 ...,然后您必须点击链接器设置标签。



在右侧,您会看到其他链接程序选项
您必须输入 -lpthread 然后按OK。



您可能需要点击重建


I've been trying to compile a simple multithreaded piece of code I found online in an effort to learn how to multithread.
To run this piece of code I need to use the compiler flags: -pthread and -std=c++0x.
But whenever I try to add the flags the build log doesn't show them being used.

I've tried some generic tips online to get these to work, but none of them worked. Can someone help?

I've tried other advice online to add compiler flags to code blocks, but when I do that and check the build log none of them appear.

解决方案

Because This Question was marked as Duplicate, even if doesn't have to do with it, because there is about Linker Flag and here is about Compiler Flags, I will post My answer HERE.

You will have to go to Settings -> Compiler... and next you'll have to click on Linker Settings TAB.

On the right side you will see Other Linker Options. There you have to type -lpthread and press OK.

You may need to click on rebuild after that.

这篇关于如何在代码块上添加编译器标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆