1

我正在使用 C 编程的代码块,我的问题是当我运行我制作的程序时,我在构建日志中得到了这个语句。

-------------- Build: Debug in C assignment (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o "bin\Debug\C assignment.exe" obj\Debug\main.o    
mingw32-g++.exe: Internal error: Aborted (program collect2)
Please submit a full bug report.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)

这是什么意思 ?我的程序中有输出语句,但我没有得到所需的输出,而是在构建日志中得到了上述消息。顺便说一句,我是 C 语言的新手,这也是我第一次使用代码块 IDE。

编辑:-

这是我的程序。

#include <stdio.h>


struct preparation_time{
int spongecake;
int meringue;
int chocalate;
int red_velvet;
};

void cake_order(struct preparation_time *);



main()
{

struct preparation_time caketime;

cake_order(&caketime);


}


void cake_order(struct preparation_time *thetime)
{
    int i;

    thetime->chocalate=25;
    thetime->meringue=45;
    thetime->red_velvet=60;
    thetime->spongecake=30;

     for(i=0;i<180;i++)
    {

        if(thetime->chocalate==i)
        {
            printf("Chocalate cake");
            thetime->chocalate=thetime->chocalate*2;

        }
    if(thetime->spongecake==i)
    {
        printf("Sponge cake");
        thetime->spongecake=thetime->spongecake*2;
    }

    if(thetime->meringue==i)
    {
        printf("Meringue");
        thetime->meringue=thetime->meringue*2;

    }

    if(thetime->red_velvet==i)
    {

        printf("Red velvet");
        thetime->red_velvet=thetime->red_velvet*2;
    }

}

}

感谢您的时间。

4

1 回答 1

1

首先,你main应该return 0;。同样对于良好的风格,您应该将其明确声明为int main.

然后(我试过)编译时没有警告,程序运行正常。

最可能的问题是命令行路径有问题:反斜杠、空格、大写/小写。

  • 首先尝试obj\Debug\main.o在 -o 前面移动。
  • 尝试用正斜杠替换反斜杠。
  • 如果这不起作用,请尝试仅使用没有空格、大写或特殊字符的目录。
  • 如果这不起作用,请尝试:将所有内容放在一个目录中,并且只使用文件名,不使用路径。

不太可能的问题是这是一个实际的 (MinGW-)GCC 编译器错误,在这种情况下,您应该首先更新您的编译器并重。如果仍然失败,则按要求实际提交。

祝你好运!

于 2013-05-19T08:01:21.953 回答