如何更正错误“文件中的全局参数太多”? [英] How can I correct the error "too many global arguments in file"?

查看:80
本文介绍了如何更正错误“文件中的全局参数太多”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在C ++工作。我写了几个函数并且只使用了13个整数全局变量。

错误信息:

文件中有太多全局参数

出现,光标出现在我的一个功能的结束处。



请帮帮我。



我尝试了什么:



我试图删除其中出现错误的函数,但错误的窗台出现在另一个函数中。

Hi,
I worked in C++. I wrote several functions and use only 13 integer global variables.
the error message:
"too many global arguments in file"
appears and the cursor appears at the end line of one of my functions.

Can you help me, please.

What I have tried:

I tried to delete the function within it the error appear but the error sill appears in another function.

推荐答案

您不需要使用这么多全局变量。当你有多线程时,全局数据会变得很恐怖。



定义一个保存数据的类(或结构)。这将简化您的代码并找到错误。并且你可以初始化所有数据,并有一些很好的输出用于调试和保存到磁盘。
You dont need to use so many global variables. Global data becomes a horror when you have multi-threading.

Define a class (or a struct) which holds your data. This will simplify your code and you find the bug. And you can init all data and have some nice output for debuggging and saving to disk.


这篇关于如何更正错误“文件中的全局参数太多”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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