【问题标题】:Bloodshed Dev C++ Source file not compiledBloodshed Dev C++ 源文件未编译
【发布时间】:2019-06-27 18:23:38
【问题描述】:

我用C语言写了一个Bloodshed程序做作业,但是点击编译运行后,我得到一个错误信息:源文件未编译。我只运行了编译,它告诉我它已经完成,但是当我之后编译并运行时,我得到了相同的先前错误消息。我该如何解决?我正在使用 Windows 10,这是程序:

/*TECH 1211 Computer Programming             */ 
/*Mark Bowman                                */ 
/*Program Name  "Formatted Output of Table"  */ 
/*Spring 2019                                */ 
#include<stdio.h> 
#include<stdlib.h> 

int main (void) {
    printf("Mark Bowman\n\n");
    char airline;
    printf("Enter the first letter of the airline:");
    scanf("%c",&airline);   

    int airline_number;     
    printf("Enter the flight number:");
    scanf("%d",&airline_number);

    int hour,minute;
    char time_of_day;
    printf("Enter the departure time as  (hh:mm)");
    scanf("%d:%d %c",&hour,&minute,&time_of_day);

    float ticket_price;
    printf("Enter the ticket price:");
    scanf("%f",&ticket_price);
    printf("\n\n\nAirline Flight\tDeparture\tTicket\n\t\tNumber\tTime\tPrice\n\t  %c %d\t%d:%d %cm\t$%.2f\n\n\n--------------------------",airline,airline_number,hour,minute,time_of_day,ticket_price);     
    return(0);   
}

【问题讨论】:

  • 您应该尝试将您的代码格式化和缩进 4 个空格,以便它变得可读。上次我听说 Bloodshed Dev C++ 已经严重过时了,所以你可能想看看别的东西,除非它是课程要求。
  • 请格式化您的代码,以便于阅读。 stackoverflow.com/editing-help
  • 您发布的代码在 clang 和 gcc 各种版本中编译良好。 Bloodshed 可能使用的是旧版本的 mingw,我还没有测试过。您还应该包含收到的完整错误消息。
  • 旧的编译器?尝试将所有变量声明移动到 main.js 的顶部。即使使用非常旧的编译器,我也看不到任何其他问题。也许还可以尝试在#include 之后放置一个空格。
  • @Bob Shaffer,虽然这是一个很好的建议。我认为这个问题更多地与一些旧的 mingw 版本在 Windows Vista 和更高版本上不起作用的事实有关。提到 Collect2 似乎表明问题处于链接阶段。

标签: c


【解决方案1】:

我刚遇到这个问题,结果发现 Bloodshed Dev C++ 与 Windows 10 不兼容。如果我故意添加它们,它甚至在编译过程中都没有检测到任何错误。

幸运的是,有一个名为 Embarcadero Dev-Cpp 的开源项目,它是 Windows 10 的一个端口,他们甚至有一个运行良好的便携版本。

【讨论】:

    猜你喜欢
    • 2013-01-08
    • 2011-01-10
    • 2010-10-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2015-08-29
    • 2011-08-16
    • 1970-01-01
    相关资源
    最近更新 更多