CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Attempt to create a pointer to a constant...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

Attempt to create a pointer to a constant...
PostPosted: Mon Jun 25, 2012 1:15 pm     Reply with quote

Confused about this, cant get it running.
All time:
Code:
Attempt to create a pointer to a constant


Compiler: 4132,4133,4134 same result.

Have tried a lot now, any help on this?

All is working nice in "CodeBlocks"

**Only testing code**

Code:
#include "18F25K22.h"

const char St1[][3]={ "T1", "T2", "T3" };

void T1(){
 char TBuff[10];
 int8 i=1;
 
 sprintf(TBuff,St1[i]); //->error came here!
}

void main(){
 T1();
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Jun 25, 2012 2:35 pm     Reply with quote

1) Read the manual - search for this error.

2) Unfortunately, some of the 'fixes' for this, seem not at present to be working. Look at this thread (only a few days ago).

<http://www.ccsinfo.com/forum/viewtopic.php?t=48456>

Best Wishes
balmer



Joined: 31 May 2010
Posts: 6

View user's profile Send private message

PostPosted: Mon Jun 25, 2012 5:28 pm     Reply with quote

You may try with strcpy( ) isof sprintf(), as for this function source of data may be either a pointer to a RAM array of characters or it may be a constant string.

Code:

const char St1[][3]={ "T1", "T2", "T3" };

void T1(){
 char TBuff[10];
 
 int8 i=1;
 
 strcpy(TBuff,St1[i]);
}

void main(){
 T1();
}   

hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Tue Jun 26, 2012 5:41 am     Reply with quote

Hi

Thanks for your reply and link on this @Ttelmah.

I have exact the same problem, 4129 is running well but after that version the problem start.
I have reported to CCS for month ago on 4131 but no reply, some days ago I reported the same in 4133 but no reply at all??

Can see @PCM programmer have reported it too but no reply.

Hmmm hope CCS will fix what the was running in the past.
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Tue Jun 26, 2012 7:27 am     Reply with quote

Realistically this goes back to the (sad but true) mantra, that 'new versions from CCS, are beta at best'.

Unless you need a feature offered by a new version, it is much safer to stick with the known. 'Routine upgrading' with CCS is something that should not be done. When you start a project, keep the compiler you use with it, and if you install a new version, keep the old as well.

In the front of all my projects, you will find a list of the project version numbers, what I've changed/fixed, but also what compiler was used with the code, and when the code is archived, the compiler goes with it.....

They for a little while seemed to have slightly improved, with several versions in the low four dot one hundred's appearing without introducing new problems, but unfortunately seem to have gone 'back' to their old habit again now. :(

I wonder what happens if you take the new .dat file from (say) 4.133, and try it with something like 4.128?. Might give the new chips (of which there are quite a lot recently), without the problems

Best Wishes
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Tue Jun 26, 2012 9:42 am     Reply with quote

Ttlemahs advice is excellent on this matter.

i suggest using a new compiler version under 3 well defined conditions:

1- to gain support for a NEW PIC part
2- for a useful new addition to the intrinsics that a new version offers
3- to fix a bug

"because i can" is not a reason to switch Very Happy Very Happy
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Thu Jun 28, 2012 5:29 am     Reply with quote

**The problem is confirmed by CCS will be fixed in next release:-)**
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group