Jump to content
Sign in to follow this  
FrankGe

Extern Bit B, B2 Linker Problem

Recommended Posts

BOOST 1.9.2

 

A little project with 3 files

 

Main.c

--------

 

#include <system.h>

#include "main.h"

 

bit b, b2;

char c, c2;

 

void main()

{

b = b2 = 0;

c = c2 = 0;

}

 

main.h

--------

#ifndef _Test_h_

#define _Test_h_

 

extern bit b, b2;

extern char c, c2;

 

#endif

 

test.c

-------

#include <system.h>

#include "main.h"

 

void test(void)

{

b = b2;

char d = c;

}

 

 

When I link this then i got this error

 

BoostC Optimizing C Compiler Version 1.9.2 Beta (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

success

BoostLink Optimizing Linker Version 1.9 Beta

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

Warning: argument of 'delay_us' calls must have a value of 1 or more

Error: Failed to resolve external:b2

Error: Failed to resolve external:b2

 

Failed

Exit code was -1. [No error.]

Removing target: main.hex

Failed to locate output file 'main.hex'

Done

 

Failed

Share this post


Link to post
Share on other sites

FrankGe,

 

Looks like a compiler problem.

 

It goes wrong when variables declared in a list eg:

 

extern c, c2;

// bad when external, fails to link
// char c, c2; 

// good
char c;
char c2;

void main()
{
   c = 0;
   c2 = 0;
}

so the workaround is for now to declare vars invidually.

 

Regards

Dave

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

×
×
  • Create New...