Header is not accepted

Aug 1, 2013 at 5:53pm
Hello everyone. I am new to c++ and am using C++ Primer 5/e to help me get an understanding of the language. In introduction to classes section in the book, there is a #imclude "Sales_item.h" but it will not be excepted. I am using the newest version of xcode on a MacBook Air, if that helps. Is there any way I can make it except Sales_item.h? Thank you.
Last edited on Aug 1, 2013 at 6:48pm
Aug 1, 2013 at 5:55pm
closed account (Dy7SLyTq)
is it in the directory of the main?
Aug 1, 2013 at 6:16pm
It is in main.cpp if that's what you mean. Sorry if I sound clueless (it's because I probably am). Thanks.
Aug 1, 2013 at 6:24pm
closed account (Dy7SLyTq)
no i mean is Sales_item.h in the same folder as main.cpp?
Aug 1, 2013 at 6:49pm
No I couldn't figure out how to do that on my Mac, it created its own desperate folder within the same project. Even when I tried to use it in the sewerage folder it wouldn't work because it didn't work on main.
Aug 1, 2013 at 7:04pm
closed account (Dy7SLyTq)
desperate
im gonna assume that you meant seperate.
sewerage
no idea what you meant there

what if you post your code?
Aug 1, 2013 at 8:05pm
I'm sorry spellcheck really messed me up haha. I meant seperate both times. Really sorry for any mistakes, English isn't my first or second language.

#include <iostream>
#include "Sales_item.h"
int main ()
{
Sales_item book;
std::cin>> book;
std::cout << book << std::endl;
return 0;
}
The problem is the #include "Sales_item.h", apparently the file does not exist.
Last edited on Aug 1, 2013 at 8:10pm
Aug 1, 2013 at 8:10pm
sewerage

LOL, you aren't using Apple's auto-correct spell checker are you?
Or are you using an online translator to turn stuff into English?

How did you get main in the folder? On a mac, you really just need to open Finder and find the "Sales_item.h" file, copy it, then navigate over to your program's folder, and paste.

If you are using XCode, you can add the dependency directly in the dependencies list.

Good luck!
Aug 1, 2013 at 8:16pm
Yes I'm using the apple spell check. Could you please write the steps a little more simply and more detailed? Sorry if too much. Where is the dependency list? What do you mean by paste it into my program? How can I enable the main to accept it? Thanks for your help.
Topic archived. No new replies allowed.