i have somproblems regarding devc++

Jun 6, 2009 at 3:22am
this is my problems:
51:16 C:\Users\ekkiang\Desktop\miniproject.cpp [Warning] unknown escape sequence '\S'
[Linker error] undefined reference to `IntroPage()'
51:16 C:\Users\ekkiang\Desktop\miniproject.cpp ld returned 1 exit status


this is my coding:
/*create user-define functions
this is a user define demo*/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

void CountOnRun(); //step2 function prototype
void CountOnSpot(); //step2 function prototype
void LetGo(); //step2 function prototype
void CleanUp(); //step2 function prototype
void IntroPage();
void SelectionMenu();

int main()
{
IntroPage();
SelectionMenu();
printf("\n");
system("pause");
return 0;
}





void intropage()
{
system("cls"); // clear previous screen
printf("\tC Programming Miniproj Intropage\n");
printf("\t=================================\n");
printf("\tModule Group: A7\n");
printf("\tTasks & members:\n");
printf("\tCount On Run -- Tan Ek Kiang\n");
printf("\tCount On Spot -- Tan Ek Kiang\n");
printf("\tLet Go -- Tan Ek Kiang\n");
printf("\tClean Up -- Tan Ek Kiang\n");
printf("\tPress any key to continue . . .");
getch();

}



void SelectionMenu()
{
char keynum;
do
{
system("cls"); // clear previous screen
printf("\Selection Menu\n");
printf("1. Count On run\n");
printf("2. Count On Spot\n");
printf("3. Let Go \n");
printf("4. Clean Up\n");
printf("5. Exit\n");
printf("Enter your selection here: ");
scanf(" %d",&keynum);
keynum=getch();

if (keynum == 1)
{
CountOnRun();
}
else if(keynum == 2)
{
CountOnSpot();
}
else if (keynum ==3)
{
LetGo();
}
else if (keynum == 4)
{
CleanUp();
}
else if(keynum =='5')
{

}
else
{
printf("\tInvalid Key\t");
_sleep(1000);
}
}while (keynum >='5');


}

/*step 1: create the function */
void CountOnRun()
{
char character;
int num;
do
{
system("cls");// clear system screen

printf("\tCount On Run Operation\n");
printf("\t======================\n\n");
printf("\t");

for(num=0 ; num<21 ; num++)
{
printf("%02d \a",num);
_sleep(500);
}

printf("\n\n");
printf("\tTry Again?");

character = getch();
}
while (( character == 'y') || ( character == 'Y'));// character must be only y or Y
return SelectionMenu();
}

void CountOnSpot()
{
char character;
int num;
do
{
system("cls");// clear system screen

printf("\tCount On Spot Operation\n");
printf("\t======================\n\n");

for(num=0 ; num<21 ; num++)
{
printf("\t%02d \a\r",num);
_sleep(500);
}

printf("\n\n");
printf("\tTry Again?");

character = getch();
}
while (( character == 'y') || ( character == 'Y'));// character must be only y or Y
return SelectionMenu();
}

void LetGo()
{
char character;
int num;
do
{
system("cls");// clear system screen

printf("\tClean Up Operation\n");
printf("\t======================\n\n");
printf("\t@ * @ * @ * @ * @ * @ * @ * @ * @ * @ * ");

for(num=0 ; num<38 ; num++)
{

printf("\b\b\b_\a");
_sleep(200);
printf(" ");
_sleep(200);


}

printf("\n\n");
printf("\tTry Again?");

character = getch();
}
while (( character == 'y') || ( character == 'Y'));// character must be only y or Y
return SelectionMenu();
}

void CleanUp()
{
char character;
int num;
do
{
system("cls");// clear system screen

printf("\tClean Up Operation\n");
printf("\t======================\n\n");
printf("\t@ * @ * @ * @ * @ * @ * @ * @ * @ * @ * ");

for(num=0 ; num<38 ; num++)
{

printf("\b\b\b_\a");
_sleep(200);
printf(" ");
_sleep(200);


}

printf("\n\n");
printf("\tTry Again?");

character = getch();
}
while (( character == 'y') || ( character == 'Y'));// character must be only y or Y
return SelectionMenu();
}


Last edited on Jun 6, 2009 at 3:24am
Jun 6, 2009 at 3:55am
printf("\Selection Menu\n");
Perhaps you meant printf("\\Selection Menu\n");?
Jun 6, 2009 at 3:57am
huh??? wads wrong with it?
Jun 6, 2009 at 4:05am
All backslashes start escape sequences. If the escape sequence is unknown, like in this case, \S, the compiler complains.
Last edited on Jun 6, 2009 at 4:06am
Jun 6, 2009 at 4:10am
oh ya thnx but what about the
ld returned 1 exit status
Jun 6, 2009 at 4:12am
after a added t after the backslash this problem still exists...
[Linker error] undefined reference to `IntroPage()'
51:16 C:\Users\ekkiang\Desktop\miniproject.cpp ld returned 1 exit status
Jun 6, 2009 at 4:20am
You're not defining IntroPage(). You're only declaring it.
Jun 6, 2009 at 4:25am
sorry im veri lousy at this subject has only learnt for few weeks.
so how do i do it ar??
Jun 6, 2009 at 4:41am
Example:
Declaration:
void IntroPage();
Definition:
1
2
3
void IntroPage(){
    //...
}
Jun 6, 2009 at 4:44am
so the correct way is?
Jun 6, 2009 at 4:57am
You need to define it. (the second way)
Jun 6, 2009 at 1:57pm
can anyone explain to me i still dun understand.... or do out the part in a larger scale....
Jun 6, 2009 at 2:22pm
ok unerstooded but i have 1 more problem... any one can run my codes i cannot enter into the selected items...
Jun 6, 2009 at 5:08pm
1
2
scanf(" %d",&keynum);
keynum=getch();


In this, you are getting a number into keynum (NOT A CHARACTER) which will probably not be what you want. Then, you are changing it to the character after what you entered (probably a \n) which will make you unable to enter any of your if statements.

Btw, please unlearn conio.h, it's a crappy header file that sucks, and don't use System().
Topic archived. No new replies allowed.