Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Compilation Errors..

Posted on 2006-07-18
10
224 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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 create, access, and change arrays in the C programming language.

861 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