Closed. This question is off-topic。它当前不接受答案。
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
3年前关闭。
我正在尝试编写一个程序,该程序将能够在c中读取.asm文件。
这是我编写的代码,但是我不断收到代码中的多个错误。
我在第19行有一个特定的错误
标签未声明(此功能首次使用)
我的理解是,我已经声明了该功能(第2行)。
第19行的另一个错误
每个未声明的标识符对于出现在每个函数中仅报告一次
至于这个错误,我不确定是什么问题。
想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
3年前关闭。
我正在尝试编写一个程序,该程序将能够在c中读取.asm文件。
#include <stdio.h>
int preprocess_get_line(char label[], char instruction[], FILE* fp);
int main(int argc, char *argv[])
{
/* Open file and check success */
char *filename = "helloworld.asm";
if (argc >1)
{
filename = argv[1];
}
FILE* inputfile = fopen(filename, "r");
if(inputfile == NULL)
{
fprintf(stderr, "Unable to open \"%s\"\n", filename);
return 1;
}
while (preprocess_get_line(label, instruction, inputfile))
{
fprintf("%s: %s", label, instruction);
}
return 0;
}
int preprocess_get_line(char label[], char instruction[], FILE* fp)
{
fgets(str,260, fp);
while(character != EOF)
{
printf("ASCII hex: %2x '%c'\n", (int)character, character);
character = fgets(inputfile);
}
fclose(inputfile);
}
这是我编写的代码,但是我不断收到代码中的多个错误。
我在第19行有一个特定的错误
标签未声明(此功能首次使用)
我的理解是,我已经声明了该功能(第2行)。
第19行的另一个错误
每个未声明的标识符对于出现在每个函数中仅报告一次
至于这个错误,我不确定是什么问题。
最佳答案
在第19行上未定义label
和instruction
。您定义了inputfile
,但未定义其他两个。
关于c - 通过读取函数在编译器中读取.asm文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35708766/