我在我的代码中有一个很大的整数数组,如下所示,它将保存像素数据。在一些内部操作之后,我需要检查数组中的所有元素是否都是'0‘,或者我是否有一些有效的值。目前,我的代码正在循环中运行以验证它。
int a[1000000];
有没有最好的方法来检查数组中的所有零值?
操作系统: Linux
请在内存效率和时间效率方面给我建议解决方案。
谢谢,Parthiban N
我正在使用一个32位的Ubuntu系统,我的目标是为arm架构(beagleblack)编译我的C++程序。但是,我的C++程序需要libboost,这意味着我在编译时会遇到这样的错误:
/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lboost_system
-bash: /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld:: No such file or directory
在阅读了一些博客之后,我认为我必须自己为ARM
我正在学习本教程:
尝试交叉编译一些c++代码,但得到以下错误:
19:36:00 **** Incremental Build of configuration Debug for project test ****
make all
Building file: ../src/test.cpp
Invoking: Cygwin C++ Compiler
arm-unknown-linux-gnueabi-g++ -IC:\Dev\cygwin64\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\s
#ifndef _WINDOWS
if(condition)
{
printf("to do in linux");
}
else
#endif
{
printf("should work in both linux and windows...");
}
我的问题是:这段代码在linux和windows中都有效吗?
我在将Linux工具移植到Windows时遇到了问题。我在Windows系统上使用MinGW。我有一个处理所有输入/输出的类,里面有这一行:
mkdir(strPath.c_str(), 0777); // works on Linux but not on Windows and when it is changed to
_mkdir(strPath.c_str()); // it works on Windows but not on Linux
你知道我能做些什么,让它在两个系统上都能工作吗?