I'm trying to read a struct of a program i wrote in c++ into a c program. I created a .h with the struct and the extern C for the function. Then i wrote the C++ program that read a csv file and save some elements in a struct. Now i have to recall the struct in a C program and read the values but i'm having a lot of problems. I don't know if i make some mistake in the .cpp file , in the .h file or in the C program. I'm working under linux.
My .h file is :
typedef struct Buses{
 int maggiore;
 int minore;
}BusesStruct;
#ifdef __cplusplus
extern "C" {
#endif
    void get_buses(BusesStruct *);
#ifdef __cplusplus
}
#endif
My cpp is
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <algorithm>
#include "lettura.h"
using namespace std;
void get_buses(BusesStruct * bus_scelti){
//leggo il file csv
    string line,nomefile;
    ifstream myfile;
    cout << "Quale file si vuole aprire? " << endl;
    cin >> nomefile;
    myfile.open(nomefile.c_str());
    int j=0;
    if (myfile.is_open()) {
        int primobus;
        int secondobus;
        cout << "Digitare il numero di uno dei due BUS sul quale si vuole eseguire l'operazione (1-9): " << endl;
        cin >> primobus;
        cout << "Digitare il numero di un secondo BUS sul quale si vuole eseguire l'operazione (1-9): " << endl;
        cin >> secondobus;
        int bus1_scelto;
        int bus2_scelto;
        while (getline(myfile,line)) {
            istringstream myline(line);
            string bus[10];
            for (int i=0; i<9; i++){
                    getline(myline,bus[i+1],';');
                }
            for (int i=0; i<10; i++){
                if(i == primobus){
                    int bus1_scelto_c = atoi(bus[i].c_str());
                    bus1_scelto=bus1_scelto_c;
                }
                if(i == secondobus){
                    int bus2_scelto_c = atoi(bus[i].c_str());
                    bus2_scelto=bus2_scelto_c;
                }
            }
            bus_scelti[j].maggiore=max(bus1_scelto,bus2_scelto);
            bus_scelti[j].minore=min(bus1_scelto,bus2_scelto);
            j=j+1;          
        }   
    }
}
In my C file i wrote #include lettura.h to recall the function : 
BusesStruct bus_scelti[10005];
get_buses(bus_scelti);
And to define my vector and recall the function.
I got the error :
reference not define to 'get_buses'.
Can you help me? Thanks
 
     
    