1
I need to receive values float to store in a struct, however, these values must be validated by means of a validation function.`
The function that reads and validates these values is working correctly, but when I try to call it within the function that will store within the structaccuses: "Undefined Reference to 'lerfloat' ".
The function lerfloat:
float lerfloat()
{
    float f;
    char c;
    int ret;
    do
    {
        puts("Insira um numero: \n");
        ret=scanf("%f",&f);
        fflush(stdin);
        if(ret==1)
        {
            return f;
        }
        else{
            puts("Digite apenas numeros por favor.\n");}
    }while(ret!=1);
    return f;
}
The function to store the values:
#include <stdio.h>
#include <stdlib.h>
#include "headLer.h"
struct armazenar
{
    float x;
    float y;
};
float func_lerVetor(float vet_pontos[][2], int n)
{
    struct armazenar p;
    int i;
    for(i=0;i<n;i++)
    {
        p.x= lerfloat();
        vet_pontos[i][0]=p.x;
        p.y= lerfloat();
        vet_pontos[i][1]=p.y;
    }
    return 0;
}
headLer. h
#ifndef FUNCLERN_H_INCLUDED
#define FUNCLERN_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
int func_lerN();
float lerfloat();
float func_lerVetor();
#endif // FUNCLERN_H_INCLUDED
I can’t see where I’m going wrong, the function lerfloatthis duly defined in headLer.h.
ps.:the function calls read vector pq it reads coordinates of a vector.
ps2.: I already tried to put the prototype of lerfloatin func_lerVetorand the error continued.
The lerfloat class has been compiled?
– TotallyUncool
Do you say if it worked properly? If so, yes, I tested it before implementing func_lerVetor and it was working properly.
– soAna
Using any IDE? or doing everything by linux, command line, etc?
– TotallyUncool
Ta all in project or this selecting and giving build?
– TotallyUncool
everything is in project.
– soAna