Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22001

undefined reference to getdelim() error (Windows) (C Language)

$
0
0

I am trying to work with getdelim() function which apperantly is the preferred method with getline() over fgets(). However, when I try to run the code below, I get undefined reference to getdelim() error.

I don't think it has anything to do with the code but rather the gcc version that I am using. So to the cmd I typed gcc -v and apperantly I have gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project)

I am not sure how old it is or if that's the problem. If so, what version of the gcc should I use and can I solve this with adding some fancy macros?

Code:

#include <stdio.h>

int main()
{
    int size = 10;
    char *string;

    printf ("Please enter a string: ");

    string = (char*)malloc(size);

    getdelim (&string, &size, '-', stdin);

    printf( "%s\n", string );

    return 0;
}

Viewing all articles
Browse latest Browse all 22001

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>