• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating a Constants.h file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating a Constants.h file


  • Subject: Creating a Constants.h file
  • From: "Kiel Gillard" <email@hidden>
  • Date: Tue, 21 Dec 2004 01:40:01 -0700

Hi there fellow coders!

I was wondering if you guys could help me with a seemingly simple problem I'm having with my project. I have a header file called "Constants.h" which simply lists 2 strings and a enum variable that I'd like to be constant in any class that I import them into. While I'm not using them in the header file, I may use 1 of the strings in the implementation file. However, when I compile my program, the compiler displays warnings telling me that I haven't used the strings. Furthermore, if a class imports the header file of another class that uses the "Constants.h" file then the compiler will also complain and state the same, obvious message - that I haven't used the two strings.

This situation is similar to when one declares a variable in a method and does not use it.

I know somebody else that is working on a project which used a Constants.h file and he does not have the same problem. We both cannot determine what the problem is.

I guess I should add that I have not locally re-declared any of the variables in the implementation file. In the header files for any my classes that use one or more of the constant variables in the project, I type #import "Constants.h" The Constants.h files is almost as follows:

#pragma mark -
enum enumeratorTag {
	value1 = 0,
	value2 = 1,
	value3 = 2,
};

#pragma mark -
static NSString * MY_CONSTANT_STRING = @"I want to";
static NSString * ANOTHER_CONSTANT_STRING = @" work for Apple";

#pragma mark -

Have I done something wrong? Thank you in advance!

Kiel  :-)
"Violence is the last refuge of the incompetent."
Isaac Asimov, Foundation

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Creating a Constants.h file
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Getting Pixel Position in an image
  • Next by Date: Re: @distinctUnionOfObjects changes the order of objects?
  • Previous by thread: Re: Getting Pixel Position in an image
  • Next by thread: Re: Creating a Constants.h file
  • Index(es):
    • Date
    • Thread