Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:38:20+00:00 2026-06-15T21:38:20+00:00

I am getting error messages in the implementation file (commented out) for Constants declared

  • 0

I am getting error messages in the implementation file (commented out) for Constants declared in the header file. Why is the compiler doing this?

Thanks in advance.

Header file:

#import <UIKit/UIKit.h>

#define kFilling Component 0
#define kBread Component 1

@interface BIDDoubleComponentViewController : UIViewController
<UIPickerViewDelegate, UIPickerViewDataSource>

@property (strong, nonatomic) IBOutlet  UIPickerView *doublePicker;
@property (strong, nonatomic) NSArray *fillingTypes;
@property (strong, nonatomic) NSArray *breadTypes;

- (IBAction) buttonPressed;


@end

Implementation file:

#import "BIDDoubleComponentViewController.h"


@implementation BIDDoubleComponentViewController

- (IBAction)buttonPressed
{
    NSInteger fillingRow = [self.doublePicker selectedRowInComponent:kFillingComponent]; // Use of undeclared identifieer 'kFillingComponent'
    NSInteger breadRow = [self.doublePicker selectedRowInComponent:kBreadComponent]; // Use of undeclared identifieer 'kBreadComponent'

    NSString *filling = self.fillingTypes[fillingRow];
    NSString *bread = self.breadTypes[breadRow];

    NSString *message = [[NSString alloc] initWithFormat:@"Your %@ on %@ will be right up.", filling, bread];

   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thank you for your order"
                                                message:message
                                               delegate:nil
                                      cancelButtonTitle:@"Great"
                                      otherButtonTitles:nil];
    [alert show];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.fillingTypes = @[@"Ham", @"Turkey", @"Peanut Butter", @"Tuna salad", @"Chicken salad", @"Roast Beef", @"Vegemite"];
    self.breadTypes = @[@"White", @"Whole Wheat", @"Rye", @"Sour Dough", @"Seven-Grain"];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark
#pragma mark Picker Data Source Methods

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 2;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    if(component == kBreadComponent) // Use of undeclared identifieer 'kFillingComponent'
    {
        return [self.breadTypes count];
    } else {
        return [self.fillingTypes count];
    }
}

#pragma mark Picker Delegate Methods

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    if(component == kBreadComponent) // Use of undeclared identifieer 'kBreadComponent'

    {
        return self.breadTypes[row];
    } else {
        return self.fillingTypes[row];
    }
}


@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:38:21+00:00Added an answer on June 15, 2026 at 9:38 pm

    Your defines are bad. You have

    #define kBread Component 1
    

    But you’re using kBreadComponent. What the #define is doing is it’s defining a token called kBread that evaluates during preprocessing to the tokens Component 1. You probably meant to use

    #define kBreadComponent 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My custom error messages quit working somewhere along the way and I'm getting this
I am getting error messages from the mbed C++ compiler that seem to be
__declspec(dllexport) ClassName *c; placed in the header getting me a lot of error messages
I am getting this error that I can't figure out. error: Automatic Reference Counting
I'm getting error messages for no reason in RAD 8: And the error message
I've been getting these messages in apache error.log for quite a while: [client 217.197.152.228]
Am getting this error message and matched my brackets and couldn't find anything wrong.
I'm getting this error message whiile running a Webservice I'm working on. it builds,
I'm getting this error message with the code below: class Money { public: Money(float
I am getting the Error/Warning about a part of my code saying 'Messages Without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.