Please Help

This is a discussion on Please Help within the C Programming forums, part of the General Programming Boards category; I'm doing a project for my c programing class and I'm stuck I keep getting the error Building Et156 Fitness ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    2

    Please Help

    I'm doing a project for my c programing class and I'm stuck I keep getting the error

    Building Et156 Fitness Center.exe.

    POLINK: error: Unresolved external symbol '_get_menu_choice'.
    POLINK: fatal error: 1 unresolved external(s).
    *** Error code: 1 ***
    Done.

    this is my source code
    insert
    Code:
    #include <stdio.h>
    
    int get_menu_choice(void);
    
    char lname[30], fname[30];
    
    int wgt, wst, hft, hin, age, thi, al, choice2;
    float bmr, hbf;
    int gender;
    int choice;
    float f1, f2, lbm, bfw, bfp, fatwt, leanwt;
    
    
    
    main()
    
    {
    personal:
    {
    	puts("Enter the last name and first name separated by spaces, then press enter.");
    
    	scanf("%s %s ", lname, fname);
    
    	printf("\nEnter your weight ");
    	scanf("%d", &wgt);
    	printf(" \n Enter your waist measuremen \nt");
    	scanf("%d", &wst);
    	printf("Enter height in feet and inches \n");
    	scanf("%d  %d", &hft, &hin);
    	printf("Enter your Age \n");
    	scanf("%d", &age);
    	printf("Enter 1 for male 2 for female \n");
    	scanf("%d", &gender);
    	
    
    }
    
    
    
    	
    	menu:
    	
    	choice = get_menu_choice();
    	if(choice ==1)
    	{ 
    f1=(wgt*1.082)+ 94.42;
    f2= wst* 4.15;
    lbm= f1-f2;
    bfw= wgt- lbm;
    bfp= (bfw* 100)/ wgt;
    
    fatwt= wgt* bfp;
    leanwt= wgt- fatwt;
    
    
    		
    	}
    	if(choice==2)
    	{
    		if(gender== '1')
    		bmr= 66+(6.23* wgt) + (12.7* thi)- (6.8*age);
    	else
    	bmr=655+(4.35* wgt)+(4.7* thi)-(4.7* age);
    	}
    	if(choice==3)
    	{
    	menu2:
    		printf(" Active menu \n");
    		printf("1. Sedentary \n ");
    		printf("2. Moderatetely Active \n");
    		printf("3. Very Active \n ");
    		printf("Enter Choice");
    		scanf("%d", &choice);
    		if (choice== 1)
    		hbf=bmr* 1.2;
    		if(choice==2)
    		hbf=bmr* 1.55;
    		if(choice==3)
    		hbf=bmr* 1.725;
    if(choice>3||choice<1)
    	{
    		printf("Try again \n");
    		goto menu2;
    	}
    		
    
    	
    	printf(" Your BMR= %f \n",bmr);
    	printf("Your HBF=%f \n ",hbf);
    	}
    	if(choice==4)
    	{
    		printf("\n %s %s", fname, lname);
    		printf("\n Your weight is %d", &wgt);
    		printf("\n Your height is %d ft  %d in", hft, hin);
    		printf(" \n Your body fat percentage is %f", bfp);
    		printf(" Your BMR= %f \n",bmr);
    		printf("Your HBF=%f \n ",hbf);
    		printf(" \n You are %f lean " , leanwt);
    		printf(" \n You are %f fat \n" , fatwt );
    		 }
    	if(choice==5)
    	goto exit;
    			
    
    
    	goto menu;
    	exit:;
    	printf("\n exiting Program");
    
    
    
    
    }
    I've been trying to firgure it out for a couple of hours and haven't had any luck, I'm still pretty new to all of this. If any one could help I would be very thankful!

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,762
    POLINK: error: Unresolved external symbol '_get_menu_choice'.
    POLINK: fatal error: 1 unresolved external(s).
    *** Error code: 1 ***
    Done.
    Technically, your linker can't find the code that is invoked by using the () operator on the get_menu_choice symbol. That prevents the linker from making the executable, even though it does compile. It's the same kind of error you would get if you left out a header file you were actually using code from. The error isn't fixed until you write the get_menu_choice function.

    Also what is with all those labels? Shouldn't they be functions?

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by whiteflags View Post
    Technically, your linker can't find the code that is invoked by using the () operator on the get_menu_choice symbol. That prevents the linker from making the executable, even though it does compile. It's the same kind of error you would get if you left out a header file you were actually using code from. The error isn't fixed until you write the get_menu_choice function.

    Also what is with all those labels? Shouldn't they be functions?
    Actually... by the time you weed out the gotos... that get_menu_choice(); hanging out in the middle of noplace IS supposed to be the function.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nick504 View Post
    I'm doing a project for my c programing class and I'm stuck I keep getting the error

    Building Et156 Fitness Center.exe.

    I've been trying to firgure it out for a couple of hours and haven't had any luck, I'm still pretty new to all of this. If any one could help I would be very thankful!
    Ok, I want to ask you not to take this too personally... but I'm not holding much hope of that succeeding...

    What you have there is a mishmash of 1980s BASIC, C and whathaveyou. I strongly suggest you hit the books and put in an honest effort to learn C...

    1) Never use goto unless you have no choice and even then never goto a label out side the current scope... that's a path to nothing but problems.

    2) Pay special attention to how functions work. It's pretty simple stuff really...

    3) Write your own code. Nobody ever learned programming with scoop and poop code.

    Sorry... it's harsh, but...

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    2
    Thank you all of you and CommonTater you aren't harsh programing is not my strong suite, I going to school for electrial engneering, C programing is just one of my classes. I like it but the instructor doesn't explain everything good enuf

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nick504 View Post
    Thank you all of you and CommonTater you aren't harsh programing is not my strong suite, I going to school for electrial engneering, C programing is just one of my classes. I like it but the instructor doesn't explain everything good enuf
    LOL... Y'know there are these rectangular things, filled with thin layers of celulose with black carbon on them... They're called books... You should try one sometime... (Just kidding)

    Seriously though, if you want to do well in your classes, forget the instructors, go on personal interest, grab some good books and tutorials and leave the guy in your dust.

    When I was going through high school and later in electronics training, I would find out what text books they were using and would read them before the class began, usually during summer holiday. Not only did I get better grades, I got the occasional really good chuckle out of silly mistakes the teachers would make...

  7. #7
    -bleh-
    Join Date
    Aug 2010
    Location
    somewhere in this universe
    Posts
    460
    I have to agree with Tater there. I have hardly learned from the instructor. I find that reading the book, going over the examples, and creating scenarios and trying to solve them are the best ways to learn.
    "All that we see or seem
    Is but a dream within a dream." - Poe

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Absolutely... We learn by doing.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21