- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个很大的源代码,我想将其分成一些模块(.h 和 .c 文件)...因为我有一个 2000 行的唯一源代码文件...
让我们进入问题:
-我正在该代码中使用表达式库 libMathEval...
-我使用以下命令编译大源代码文件:
gcc -DMAX_ESTRELLAS_SELECCIONADAS=1000000 crowd_2cond.c -lmatheval -o run2sec
-为了运行我使用:
./run2sec ./fparameters.txt
-控制台中的结果是:
Tiempo para lectura de ficheros, calculo de expresiones, creacion de estructuras (listas, IndiceAVL y IndiceVector) y liberacion de IndiceAVL: 3.7689 segundos
Tiempo para algoritmo: **68.7716 segundos**
Tiempo para escritura de ficheros y liberacion de memoria: 3.9501 segundos
Tiempo SECUENCIAL total (avl-serializado 2-index 2-cond Optimizado): 76.4906 segundos
程序产生一个正确的文件输出...
但我想将那个大源文件分离到不同的模块中...所以我从大文件的一个功能开始,所以现在我有两个文件(三个带有标题):
crowd_2cond.c(包含主要函数和所有函数减去移动到下一个文件 entrada.c 的函数)
entrada.c(头文件 entrada.h):只包含一个大函数...
因此,为了生成可执行文件,我使用以下命令:
gcc -c entrada.c
gcc -c -DMAX_ESTRELLAS_SELECCIONADAS=1000000 crowd_2cond.c
gcc -o run2sec crowd_2cond.o -lmatheval entrada.o
再次运行我使用了:
./run2sec ./fparameters.txt
显示的结果是:
Tiempo para lectura de ficheros, calculo de expresiones, creacion de estructuras (listas, IndiceAVL y IndiceVector) y liberacion de IndiceAVL: 3.7941 segundos
Tiempo para algoritmo: **1.4577 segundos**
Tiempo para escritura de ficheros y liberacion de memoria: 3.6116 segundos
Tiempo SECUENCIAL total (avl-serializado 2-index 2-cond Optimizado): 8.8634 segundos
程序产生的文件输出在这种情况下是不正确的...粗体显示的时间不同...
两次执行的代码差异只是entrada.c中函数的分离,其他的我没接触过...
希望有人能帮助我提前感谢大家曼纽尔。
最佳答案
你对初始化的建议让我发现了错误。
正如您所说,问题是初始化错误。
#ifndef ENTRADA_H
#define ENTRADA_H
#include <stdlib.h> ---This was not in the entrada.h file---
#include <stdio.h>
#include <string.h>
#include "tipos.h"
ParametrosEjecucion leerParametrosEntrada(int nparam, char *argv[], int num_lineas);
#endif
在“leerParametrosEntrada”中,我使用 atof 将字符串转换为 float ,如果不包含 stdlib.h 文件,该函数似乎表现不佳。
在包含它之后一切正常......
谢谢 雇佣俄罗斯人
关于c++ - 将问题与 libMathEval 联系起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32162639/
我正在尝试执行 vagrant up 但一直遇到此错误: ==> default: IOError: [Errno 13] Permission denied: '/usr/local/lib/pyt
我在容器 div 中有一系列动态创建的不同高度的 div。 Varying text... Varying text... Varying text... Varying text.
通过 cygwin 运行 vagrant up 时遇到以下错误。 stderr: /bin/bash: /home/vagrant/.ansible/tmp/ansible-tmp-14872260
今天要向小伙伴们介绍的是一个能够快速地把数据制作成可视化、交互页面的 Python 框架:Streamlit,分分钟让你的数据动起来! 犹记得我在做机器学习和数据分析方面的毕设时,
我是 vagrant 的新手,正在尝试将第二个磁盘添加到我正在用 vagrant 制作的虚拟机中。 我想出了如何在第一次启动虚拟机时连接磁盘,但是当我关闭机器时 然后再次备份(使用 'vagrant
我是一名优秀的程序员,十分优秀!