"Launch: program main.exe does not exist" appearing when trying to run a C file

92 Views Asked by At

When i try to run main.c that error appears and it takes me to launch.json which is empty (it only shows "version": "0.2.0", "configurations": []).

Something that i think is important to take into consideration is that this only started happening when i added date.c to the project.

Maybe there's something wrong with the code? Can someone look at it and help me? Thank you in advance.

Here´s main.c

#include <stdio.h>
#include <stdlib.h>
#include "input.h"

    int main() {
        Cache cache;
        FILE *fp;
        fp = fopen("caches_all.csv", "r");
    
        char myString[1000];
        fgets(myString, 1000, fp);
    
        if (fp != NULL) {
            while (fgets(myString, 1000, fp)) {
                sscanf(myString, "%[^;];%[^;];%[^;];%[^;];%lf;%lf;%[^;];%[^;];%lf;%lf;%[^;];%d/%d/%d;%d;%d;%d;%lf",
                    cache.code, cache.name, cache.state, cache.owner, &cache.latitude, &cache.longitude,
                    cache.kind, cache.size, &cache.difficulty, &cache.terrain, cache.status,
                    &cache.hidden_date.day, &cache.hidden_date.month, &cache.hidden_date.year,
                    &cache.founds, &cache.not_founds, &cache.favorites, &cache.altitude);
    
                printf("%s %s %s %s %.6lf %.6lf %s %s %.1lf %.1lf %s ",
                    cache.code, cache.name, cache.state, cache.owner, cache.latitude, cache.longitude,
                    cache.kind, cache.size, cache.difficulty, cache.terrain, cache.status);
    
                printDate(cache.hidden_date);
    
                printf(" %d %d %d %.0lf\n", cache.founds, cache.not_founds, cache.favorites, cache.altitude);
            }
        } else {
            printf("Not able to open the file.");
            return 1;
        }
    
        fclose(fp);
    
        return 0;
    }

Here's date.c

#include <stdio.h>
#include "input.h"

Date createDate(int day, int month, int year) {
    Date date;
    date.day = day;
    date.month = month;
    date.year = year;
    return date;
}

void printDate(Date date) {
    printf("%04d/%02d/%02d\n", date.year, date.month, date.day);
}

and here's input.h

#ifndef INPUT_H
#define INPUT_H

typedef struct date {
    int day, month, year;
} Date;

typedef struct cache {
    char code[500];
    char name[500];
    char state[500];
    char owner[500];
    double latitude;
    double longitude;
    char kind[500];
    char size[500];
    double difficulty;
    double terrain;
    char status[500];
    Date hidden_date;
    int founds;
    int not_founds;
    int favorites;
    double altitude;
} Cache;

Date createDate(int day, int month, int year);
void printDate(Date date);

#endif
0

There are 0 best solutions below