December 21, 2006 Re: Help with derelict and codeblocks | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | I am just starting out in C++ one tut I have been using give me a roll dice program pretty much I have followed his steps perfectly but an dgetting this: .objs\main.o:main.cpp:(.text+0x13f): undefined reference to `rollDice()' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings everytime I try and build. I am using codeblocks. Below is a copy of the code I am using any help would be much appreciated. #include <iostream> #include <ctime> using namespace std; void rollDice (void); int main() { srand(time (0)); rollDice(); return 0; } void rolldice(void) { int die1; int die2; die1 = 1 + rand() % 6; die2 = 1 + rand() % 6; cout <<"the first dice is"<<die1 <<endl; cout <<"the second dice is"<<die2 <<endl; } |
December 21, 2006 Re: Help with derelict and codeblocks | ||||
---|---|---|---|---|
| ||||
Posted in reply to OoPs-Tk | OoPs-Tk wrote: > I am just starting out in C++ one tut I have been using give me a > roll dice program pretty much I have followed his steps perfectly > but an dgetting this: Um... this is a newsgroup for the D programming language. You should ask this on a C++ newsgroup. (But hint -- C++ is case-sensitive. rolldice!=rollDice). --bb > > .objs\main.o:main.cpp:(.text+0x13f): undefined reference to > `rollDice()' > collect2: ld returned 1 exit status > Process terminated with status 1 (0 minutes, 0 seconds) > 0 errors, 0 warnings > > everytime I try and build. I am using codeblocks. > > Below is a copy of the code I am using any help would be much > appreciated. > > > #include <iostream> > #include <ctime> > > using namespace std; > > void rollDice (void); > > int main() > > { > srand(time (0)); > > rollDice(); > > return 0; > } > > void rolldice(void) > { > int die1; > int die2; > > die1 = 1 + rand() % 6; > die2 = 1 + rand() % 6; > cout <<"the first dice is"<<die1 <<endl; > cout <<"the second dice is"<<die2 <<endl; > } > > |
Copyright © 1999-2021 by the D Language Foundation