multiple definitions error, what's wrong?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dizzyelk
    FFR Player
    • Jul 2007
    • 1

    #1

    multiple definitions error, what's wrong?

    I'm getting an error when I try to compile one of my headers. I'm using DevCPP, if that matters. Its a dice roller for a rouge-like I'm trying to write, taking in 2 variables in the format of XdY (for those of you who roleplay).

    coding follows...

    #ifndef _DICEBAG_H_
    #define _DICEBAG_H_

    using namespace std;

    int diceroll(int numof, int numside) {
    int total = 0;
    for(int curroll = 0; curroll < numof; curroll++) {
    total += rand() % numsides + 1;
    }
    return total;
    }
    #endif
  • Emu Hater
    FFR Player
    • Apr 2007
    • 230

    #2
    Re: multiple definitions error, what's wrong?

    My coding style is completely different so its hard to tell where the problem is. However,
    int diceroll(int numof, int numside) {
    int total = 0;
    for(int curroll = 0; curroll < numof; curroll++) {
    total += rand() % numsides + 1;
    the problem might be because those don't match.



    Tier Points: 270 (261 + 9 for 285 AAAs)

    Comment

    Working...