Free scale Code warrior issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Free scale Code warrior issue

403 Views
rahulkhandelwal
Contributor I

In my code i have defined two variable globally as a temporery variable.

When i tried to use them in the main function their value is set.

let i,j are globally defined variable.

void main()

{

if(i==1)

{

function();

}

}

Here in this function, The value of i is 1 but still the execution is not entering into the fiunction.

 

After that when i did like this

void main()

{int temp;

temp =i;

if(temp == 1)

{

function();

}

}

Using this method it is working.

I will be vary thankful to you if anybody tell me the reason. Any alternative solution.

Labels (1)
0 Kudos
2 Replies

275 Views
CrasyCat
Specialist III

Hello

 

- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
  To retrieve that info (For version number smaller than 10.0):
     - Start CodeWarrior
     - Select Help -> About Freescale CodeWarrior
     - Click on "Install Products"
     - CodeWarrior version used is displayed on top in the Installed Products dialog.

 

  To retrieve that info (For version number 10.0 and higher):

     - Start CodeWarrior
     - Select Help -> About CodeWarrior Development Studio

     - Version and build number are indicated under  "Installed Products" section.

 

 

CrasyCat

0 Kudos

275 Views
drummer
Contributor IV

Here is something I have discovered about Code Warrior:

I don't know if it applies to your situation or not.

I have a project that contains multiple files.

In one file a global variable is defined char in the other uint_8. The compiler reserves 4 spaces because although the variable is 8 bits in both cases it isn't the same type.

In one file I had declared a variable as int and the other as uint_32 (by mistake) and my logic wouldn't parse correctly.

I was suprised that I didn't get any warning or error from this. Subsequently I found four more instances where there was a mismatch between extern global variables. This cured a lot of freaky issues I was having.

0 Kudos