Header is not accepted

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
closed account (Dy7SLyTq)
is it in the directory of the main?
It is in main.cpp if that's what you mean. Sorry if I sound clueless (it's because I probably am). Thanks.
closed account (Dy7SLyTq)
no i mean is Sales_item.h in the same folder as main.cpp?
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.
closed account (Dy7SLyTq)
desperate
im gonna assume that you meant seperate.
sewerage
no idea what you meant there

what if you post your code?
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
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!
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.