Solved

Compilation Errors..

Posted on 2006-07-18
10
221 Views
Last Modified: 2010-04-15
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
Comment
Question by:sudarshantk
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17128505
>> adi->protocol = "slrrp";
All such assignment operator gives compilation error
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17128509
You need to use strcpy(...) function

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

Change other statements similarly.

Good luck !
0
 
LVL 8

Expert Comment

by:manish_regmi
ID: 17128511
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
 

Author Comment

by:sudarshantk
ID: 17128523
what about error at line 342
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17128527
>> 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Expert Comment

by:manish_regmi
ID: 17128535
use

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


0
 
LVL 7

Expert Comment

by:nafis_devlpr
ID: 17128815
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
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17128916
>> 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
 
LVL 7

Accepted Solution

by:
nafis_devlpr earned 125 total points
ID: 17128953
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
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17136169
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now