jdscardoso
jdscardoso

Reputation: 291

Identifier "(variable)" is undefined

I am doing debug of my program, but in VS2010 cnt is defined without any problems (same code). In VS2013 cnt is "undefined" which will result in a malfunction of the program. Any idea why?

int
adin_file_read(SP16 *buf, int sampnum)
{
    FILE *fp;
    int cnt = 0; //nº de bytes lido numa evocação da função adin_file_read
    fp = gfp;
    //sum_samples --> nº total de bytes lidos
    //global_size --> nº total de bytes do buffer de audio

    //Se é um ficheiro wav
    if (wav_p) {
        cnt = fread(buf, sizeof(SP16), sampnum, fp);
        if (cnt == 0) {
            if (feof(fp)) return -1; /* EOF */
            if (ferror(fp)) {
                jlog("Error: adin_file: an error occured while reading file\n");
                adin_file_close();
                return -2; /* error */
            }
        }
        if (nowlen + cnt > maxlen) {
            cnt = maxlen - nowlen;
        }
        nowlen += cnt;
    }
    else {  //Se é um RAW FILE
        //AXY5
        if (has_pre) {
            int i;
            has_pre = FALSE;

            for (i = 0; i <= sampnum; i++){
                if (i > global_size / sizeof(SP16)) {
                    cnt = i;
                    sum_samples = i;
                    break;
                }
                buf[i] = real_data[i];
            }

            if (cnt == 0) {
                if (sum_samples > global_size / sizeof(SP16)){
                    return -1;
                }
            } (.....continue).. return cnt;

vs2013 behavior

Upvotes: 3

Views: 2713

Answers (1)

jdscardoso
jdscardoso

Reputation: 291

Using the tip of @JoachimPileborg the problem was solved. The instructions are here and after doing that I restarted the VS2013, and now is working.

Upvotes: 2

Related Questions