help please ok here is my code

void sleep()
{
      energy 100;
      happy + 20;
      strength - 1;
      bladder 70;
      age + (hour * 8);
};

ok? all the varibles are preprocesser defined, you know #define energy 100.

i have 2 file in this project main.cpp and Brandon.cpp, the funciton is in the Brandon file

so i run the code once and everything goes ok but once i put it in the main file it says "multiple definition of "sleep()"
why?!? arg frustrating, please help.

Recommended Answers

All 5 Replies

when you say "put it", do you mean you copy the whole function
and redefine it in main?

when you say "put it", do you mean you copy the whole function
and redefine it in main?

no i mean

int main()
{
     sleep();
     cout << energy;
}

do you include the brandon ? Also try putting the protype on top
of the main file.

help please ok here is my code

void sleep()
{
      energy 100;
      happy + 20;
      strength - 1;
      bladder 70;
      age + (hour * 8);
};

ok? all the varibles are preprocesser defined, you know #define energy 100.

If this is true, what does the statement 100 100; do? (first statement)
What does happy + 20; do?

All I see are compiler errors.

If this is true, what does the statement 100 100; do? (first statement)
What does happy + 20; do?

All I see are compiler errors.

yeah, i just realized that those dont do anything but regardless i get past compiling and it links then it tells me that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.