Jump to content

Linker Failure On Mult/div C Statement


Recommended Posts

IDE version 5.9.1

Compiler and Linker versions 2.0.1 Beta

Boost C compiler

Target is PIC16F877

 

The following code compiles but linker fails (no specific failure mentioned)

 

#include <system.h>

 

void main(void)

{

unsigned short speed=10, dist=20;

unsigned short temp;

temp = speed*dist/2;

}

 

Changing the calculation:

temp = speed*dist/2;

 

to:

temp = dist*speed;

temp = temp/2; // works in linker

 

works

 

Mike

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...