×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

multiple definitions error

multiple definitions error

multiple definitions error

(OP)
I'm using the Metrowerks Codewarrior compiler, and I am trying to do something like this in a for loop, inside a void function:

if ((structArray.info & someMask) == someMask)
{
   cout << "something" << endl;
}

all I did was define three different masks globally in a header file then:
  in a function in my implementation file, I used the bitwise or--  |  --to set the above variable, using the masks, and based on a simple boolean expression
  in another function in that same file I did the above with the same three masks

thank you

RE: multiple definitions error

How exactly are you defining someMask.  Is it something like

#define MASK1 0xFF

or

const int MASK1=0xFF

If it is the latter, you need a header file with just

extern const int MASK1;

and just one code file with the definition of MASK1.  If it is using #define, there shouldn't be any problems.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close