pointer related: can't figure out this bug

This is a discussion on pointer related: can't figure out this bug within the C Programming forums, part of the General Programming Boards category; Hi, I'm getting the following error: error: incompatible types in assignment Here is the relevant struct declaration.. Code: typedef struct ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    245

    pointer related: can't figure out this bug

    Hi, I'm getting the following error:
    error: incompatible types in assignment

    Here is the relevant struct declaration..

    Code:
    typedef struct _Format_list {
        char *format_name;
        FieldList field_list;
        int struct_size;
        OptInfo *opt_info;
    }FormatRec, *FormatList, StructDescRec, *StructDescList;
    Now here's is the function declaration for the function I'm trying to call:

    Code:
    extern submit_handle * create_subscriber_mq(char * name, StructDescRec* format, char* subtype, char* function_str, char* out_subtype)
    This is how I create the struct:
    Code:
    StructDescRec format_list[] =
    {
            // a_field_list and b_field_list are of type FieldList
            {"a_rec", a_field_list, sizeof(a_record), NULL},
            {"b_rec", b_field_list, sizeof(b_record), NULL},
            {NULL, NULL, 0, NULL}
    };
    Now here is my actual call:
    Code:
    handle = create_subscriber_mq("jaitest", mq_format_list, "subtype", trans, "outsub");
    This is where the error actually occurs.. on this function call.

    Any ideas?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Is "jaitest" a pointer to an array of char's?

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by Adak View Post
    Is "jaitest" a pointer to an array of char's?
    I thought it was.. I thought "sdfsfsdf" returned a pointer to the chars...

    Anyways, I've done that stuff before for the names and i haven't really had a problem.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by Adak View Post
    Is "jaitest" a pointer to an array of char's?
    I just did
    Code:
    char* chan = "test";
    then passed chan in and I get the same error.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    2,693
    Please post the entire error message.

    Jim

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by jimblumberg View Post
    Please post the entire error message.

    Jim
    mqrec.c: In function ‘main’:
    mqrec.c:55: error: incompatible types in assignment
    mqrec.c:50: warning: unused variable ‘sub_b’
    mqrec.c:50: warning: unused variable ‘sub_a’
    make: *** [test] Error 1

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    2,693
    Is handle a pointer?

    And is it the same as submit_handle?

    Jim

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    245
    Quote Originally Posted by jimblumberg View Post
    Is handle a pointer?

    And is it the same as submit_handle?

    Jim
    You got it! I wasn't making handle a pointer. STupid oversight on my part.

    Thank you very much for the help!! CBoard does it again!

    Is there a way to donate to this board? I seriously think I should toss some money this forums way...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. symmetryc problem
    By raizard in forum C Programming
    Replies: 13
    Last Post: 08-29-2010, 09:11 PM
  2. * Character in
    By Jonnyb42 in forum C Programming
    Replies: 14
    Last Post: 01-15-2010, 09:28 AM
  3. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. bug in my prog which I cannot figure out...
    By face_master in forum Windows Programming
    Replies: 10
    Last Post: 02-14-2002, 10:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21