小编Arm*_*maa的帖子

在gcc中-lm是什么意思?

当我用编译一些C代码时gcc,需要添加-lm。例如,当我想fmax在程序中使用时,必须使用以下命令:

gcc myprogram.c -lm
Run Code Online (Sandbox Code Playgroud)

我不了解添加后会对我的程序产生-lm什么影响?什么-lm意思

谢谢。

gcc

5
推荐指数
2
解决办法
2366
查看次数

在c中使用struct

#include <stdio.h>   
struct Bar{
    int max;
    int N;
    int k[4];
    float g[4];
};


typedef struct Bar myStruct;



myStruct entr(){
    myStruct result;
    int i;

    printf("max\n");
    scanf("%d", &result.max);

    printf("N = \n");
    scanf("%d", &result.N);

    printf("\nEnter k = ");
    for(i=1; i<=4; i++) scanf("%d", &result.k[i]);

    printf("\ng = ");
    for(i=1; i<=4; i++) scanf("%f" , &result.g[i]);

    return result;
}


void main() {       
    myStruct entrs=entr();
}
Run Code Online (Sandbox Code Playgroud)

我在linux中运行此代码(使用gcc编译),每次出现以下错误

" *堆栈粉碎检测到*:./a.out终止中止"

我该如何解决这个错误?**

c loops

1
推荐指数
1
解决办法
78
查看次数

我如何修复Julia错误?

我正在使用Julia版本0.5.2.

julia> addprocs(4);
julia> a=rand(8,8);
julia> distribute(a,2)
Run Code Online (Sandbox Code Playgroud)

当我尝试使用此代码时,我收到错误:

错误:UndefVarError:分布未定义

我该怎么办?

提前致谢.

distributed-computing julia

0
推荐指数
1
解决办法
77
查看次数

标签 统计

c ×1

distributed-computing ×1

gcc ×1

julia ×1

loops ×1