Jump to content
Sign in to follow this  
Ulrich

Extern Variable Already Exists

Recommended Posts

Bug description:

Problem still exists with variables which are declared "extern", defined in one file, and accessed in another. Seems to depend on data type modifier:

Variables of type unsigned char, signed char, unsigned short etc. do not work (error says "variable already exists"), whereas variables of type char, int, or short seem to work ok. At least there is no error message. I did not do a functional test in this case.

 

Steps to reproduce:

 

Build a project containing 3 files: Main.c, module1.h, and module1.c.

 

---Main.c, begin---

#include <system.h>

 

#include "module1.h"

 

void main(void)

{

Mod1Var = 1;

Mod1Func();

}

---Main.c, end---

 

---module1.h, begin---

//#define MY_DATA_TYPE int // ok

//#define MY_DATA_TYPE signed char // NOT ok

//#define MY_DATA_TYPE unsigned char // NOT ok

//#define MY_DATA_TYPE char // ok

#define MY_DATA_TYPE unsigned short // NOT ok

//#define MY_DATA_TYPE short // ok

 

extern MY_DATA_TYPE Mod1Var;

 

extern void Mod1Func(void);

---module1.h, end---

 

---module1.c, begin---

#include "module1.h"

 

MY_DATA_TYPE Mod1Var;

 

void Mod1Func(void)

{

Mod1Var++;

}

---module1.c, end---

 

Activate one of the #define lines and build the project.

 

Expected behaviour: Should compile ok with all the data types.

 

What happens instead with data types marked as "not ok":

compiler error: module1.c(5:16): error: variable 'ModVar1' already exists

 

Is the problem 100% reproduceable: yes

 

IDE version: SourceBoost IDE version 5.6.1

Compiler: BoostC

Compiler version: 1.1 Alpha

OS: Win XP Home SP2

 

Comments:

Anyway, BoostC looks very promising :-)

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