Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Compilation Errors..

Compilation errors...
typedef struct ARPI_ADAPTOR_INFO {
  char protocol[MAX_READER_PROTO_LEN+1]; // reader side protocol implemented: slrrp, llrp, symbol-EBSP
  char major_version[MAX_MAJOR_VERSION_LEN+1];
  char minor_version[MAX_MINOR_VERSION_LEN+1];
  char patch_number[MAX_PATCH_NUM_LEN+1];
//  time_t buildTime; // Time at which adapter is built, provided by adapter.
}ARPI_ADAPTER_INFO ;

ARPI_ERROR_CODE   getInfo(ARPI_ADAPTER_INFO *adi);  // function ptr to get adapter info

ARPI_ERROR_CODE   (* ARPI_CALLBACK)(char  *buffer);
ARPI_ERROR_CODE   setCallback(ARPI_CALLBACK rb); // function ptr to set callback function

ARPI_ERROR_CODE getInfo(ARPI_ADAPTER_INFO *adi)
{
332:      adi->protocol = "slrrp";
333:      adi->major_version = "1";
334:      adi->minor_version = "2";
335:      adi->patch_number = "1";
}

342: ARPI_ERROR_CODE setCallback(ARPI_CALLBACK rb)
{}


Simba.c:332: incompatible types in assignment
Simba.c:333: incompatible types in assignment
Simba.c:334: incompatible types in assignment
Simba.c:335: incompatible types in assignment
Simba.c: At top level:
Simba.c:342: syntax error before "rb"

0
sudarshantk
Asked:
sudarshantk
  • 5
  • 2
  • 2
  • +1
1 Solution
 
rajeev_devinCommented:
>> adi->protocol = "slrrp";
All such assignment operator gives compilation error
0
 
rajeev_devinCommented:
You need to use strcpy(...) function

Something like this
strcpy(adi->protocol, "slrrp");

Change other statements similarly.

Good luck !
0
 
manish_regmiCommented:
use strcpy()
strcpy( adi->protocol, "slrrp");
strcpy( adi->major_version,  "1");
strcpy( adi->minor_version, "2");
strcpy( adi->patch_number, "1");

regards
Manish Regmi



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sudarshantkAuthor Commented:
what about error at line 342
0
 
rajeev_devinCommented:
>> 332:     adi->protocol = "slrrp";
>> 333:     adi->major_version = "1";
>> 334:     adi->minor_version = "2";
>> 335:     adi->patch_number = "1";

This is the corrected statements
strcpy(adi->protocol, "slrrp");
strcpy(adi->major_version = "1");
strcpy(adi->minor_version = "2");
strcpy(adi->patch_number = "1);

0
 
manish_regmiCommented:
use

typedef ARPI_ERROR_CODE   (* ARPI_CALLBACK)(char  *buffer);


0
 
nafis_devlprCommented:
what you are  trying to do is to assigne a const char type pointer to a char pointer. What you should be doing is this

strcpy(adi->protocol, "slrrp");
strcpy(adi->major_version, "1");
strcpy(adi->minor_version, "2");
strcpy(adi->patch_number, "1");

the final error is that you have used a type which is not defined properly, to solve this problem either do this

342: ARPI_ERROR_CODE setCallback((* ARPI_CALLBACK)(char  *buffer) rb)
{}

or this
#define ARPI_CALLBACK  ((* ARPI_CALLBACK)(char  *buffer))

ARPI_ERROR_CODE setCallback(ARPI_CALLBACK rb)
{}
0
 
rajeev_devinCommented:
>> what you are  trying to do is to assigne a const char type pointer to a char pointer. What you should be doing is this
Seems nothing new. Same comments are already posted.
0
 
nafis_devlprCommented:
rajeev

i was just giving him the explanation of the error message, nothing else. And sorry I didn't see the previous postings, damn quick post.
0
 
rajeev_devinCommented:
To sudarshantk,
I don't know on what basic you accepted the answer.

We are not interested to waste our time unnecessarily. If you are posting solutions then go through every solution carefully.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now