Error in inf file (c2059 syntax error: constant)

Asked 2 years ago, Updated 2 years ago, 131 views

I made source C with visual studio, but there is an error in the inf file that I read during the build process.

(input path)\paper.inp(1):error C2059: Syntax error: 'constant'

An error like this appears.

If .c succeeds in building, why does the input file fail?

#pragma warning(disable:4996)
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {

    FILE *inp, *out;

    inp = fopen("paper.inp", "r");

    fscanf(inp, "%d", &num);

The above is the source from which the inf file is read.

7
3 10 9 8
9 8 7 2
11 3 2 7
6 3 9 2
8 3 9 2
9 0 3 6
5 3 2 5

This is the content of the input file. (I see that error in the top line "7")

c syntax-error

2022-09-22 18:52

1 Answers

The inf file is not a compilation target. Must not be added as a source file.


2022-09-22 18:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.