Thread: Id returned 1 exit status

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    2

    Post Id returned 1 exit status

    Hi guys. I have the problem of "Id returned 1 exit status"in my program.Here is my code,I couldn't point out the reason for this error.i tried compiling it using turbo c++ and dev c++ and got the same result. Help me if u can...

    Code:
    #include <ctype.h>
    #include <stdio.h>
    int main(void)
    {
    char ch;
    
    
    for(;;) {
    ch = getchar();
    if(ch == '.') {
    break;
    }
    if(isblank(ch)){
    printf("%c is a word separator\n", ch);
    }
    }
    
    
    return 0;
    }

    output:
    [Linker error]undefined reference to 'isblank'
    Id returned 1 exit status

  2. #2
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    What is 'isblank' ?

    Looking at what you're trying to do - you might want to take a look as C functions like 'isdigit', 'isalpha' and the family.

    Look at one of the functions and you'll have a basic idea of what you want to do.... in your assignment probably.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    You should make sure your code is neatly formatted and indented; something like this:

    Code:
    #include <ctype.h>
    #include <stdio.h>
    
    int main(void)
    {
        char ch;
    
        for(;;)
        {
            ch = getchar();
            if(ch == '.')
            {
                break;
            }
    
            if(isblank(ch))
            {
                printf("%c is a word separator\n", ch);
            }
        }
    
        return 0;
    }
    I believe "isblank()" was standardized in C99, which I don't think either of your compilers support. You can look into this, or try using a different compiler: C and C++ Compiler Information and Reviews - Cprogramming.com

    Otherwise, see if "isspace()" suites your needs instead.

    Also, you should be declaring "ch" as an int, not a char, as "getchar()" returns an int (read about EOF in the FAQ to see why) and "isblank()" expects an int argument.

  4. #4
    Registered User
    Join Date
    Jul 2015
    Posts
    2
    I read isblank() as function to find out blank space in the string. It's header file is <ctype.h>. Except isblank(), i got correct results for other functions like ispunct()-to find punctuation marks and all.

    ****I declared "ch" as int, but i got the same :"Id returned 1 exit status" as error.

    ****Thank you for all your help, i used isspace() function instead of isblank() as you suggested. Its working..
    Last edited by swathi.s; 07-04-2015 at 04:03 AM.

  5. #5
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Quote Originally Posted by swathi.s View Post
    I read isblank() as function to find out blank space in the string. It's header file is <ctype.h>. Except isblank(), i got correct results for ispunct()-to find punctuation marks.
    It probably does not come with your compiler.

    It doesn't come with my compiler too.

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by swathi.s View Post
    I read isblank() as function to find out blank space in the string. It's header file is <ctype.h>. Except isblank(), i got correct results for other functions like ispunct()-to find punctuation marks and all.
    "isblank()" appears to be a more recent addition to the standard library, which your current compilers likely do not support.

    Quote Originally Posted by swathi.s View Post
    ****Thank you for all your help, i used isspace() function instead of isblank() as you suggested. Its working..
    You're welcome.

  7. #7
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    945
    I wouldn't call 1999 "recent". There's an even more recent C standard that's been out for 4 years now! Maybe it's time to upgrade to a compiler that supports at least C99?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. collect2.exe: error: ld returned 1 exit status
    By umutefiloglu in forum C Programming
    Replies: 4
    Last Post: 05-11-2014, 09:37 AM
  2. collect2: ld returned 1 exit status
    By Bryce Miller in forum C++ Programming
    Replies: 9
    Last Post: 02-28-2012, 10:28 PM
  3. collect2: ld returned 1 exit status error??
    By blindchicken11 in forum C Programming
    Replies: 11
    Last Post: 11-07-2011, 08:38 PM
  4. ld returned 1 exit status
    By madennn in forum C Programming
    Replies: 14
    Last Post: 03-29-2011, 11:26 AM
  5. ERROR collect2: ld returned 1 exit status
    By meili100 in forum C++ Programming
    Replies: 13
    Last Post: 12-04-2007, 12:20 PM

Tags for this Thread