PDA

View Full Version : how to import/include header file in Xcode 4.2.1 ?




hieuhoang
Feb 18, 2012, 04:15 AM
Hi ,

I am new to Xcode and I am struggling with this : I have some .h files and have tried to put them to /usr/include or /usr/local/include or one directory but when importing or including in xcode I met this : lexical or preprocessor issue 'string' file not found .

anyone know how to fix this ? thanks in advance



gnasher729
Feb 18, 2012, 08:54 AM
Hi ,

I am new to Xcode and I am struggling with this : I have some .h files and have tried to put them to /usr/include or /usr/local/include or one directory but when importing or including in xcode I met this : lexical or preprocessor issue 'string' file not found .

anyone know how to fix this ? thanks in advance

Slow down, cowboy.

Putting header files into /usr/include or similar is a VERY BAD IDEA unless you know exactly what you are doing - which you don't. You are in danger of SERIOUSLY MESSING UP YOUR MACINTOSH.

Why don't you start from the beginning and tell us what you are actually trying to do?

mydogisbox
Feb 18, 2012, 08:54 AM
I have some .h files and have tried to put them to /usr/include or /usr/local/include or one directory but when importing or including in xcode I met this : lexical or preprocessor issue 'string' file not found .

There are two things to check:

1. Check your system path to see if /usr/include or /usr/local/include are on your path. Do this by going to the terminal and entering "echo $path".

2. As a backup, you can set this is your project settings. In the file listing on the left side, click on the project. Go to the build settings tab and check the paths that are set there. You can specify specific paths to check for headers.

hieuhoang
Feb 18, 2012, 11:54 AM
Slow down, cowboy.

Putting header files into /usr/include or similar is a VERY BAD IDEA unless you know exactly what you are doing - which you don't. You are in danger of SERIOUSLY MESSING UP YOUR MACINTOSH.

Why don't you start from the beginning and tell us what you are actually trying to do?

thank you, but what is the good idea ? I have no ideas to start (from the beginning ) . Any advices ?

hieuhoang
Feb 18, 2012, 12:04 PM
There are two things to check:

1. Check your system path to see if /usr/include or /usr/local/include are on your path. Do this by going to the terminal and entering "echo $path".

2. As a backup, you can set this is your project settings. In the file listing on the left side, click on the project. Go to the build settings tab and check the paths that are set there. You can specify specific paths to check for headers.

Hi, I did as yours but . "echo $path" responsed nothing !

hieuhoang
Feb 21, 2012, 02:36 AM
hi, my problem was solved !

KnightWRX
Feb 21, 2012, 05:27 AM
1. Check your system path to see if /usr/include or /usr/local/include are on your path. Do this by going to the terminal and entering "echo $path".

What do you think adding /usr/include and /usr/local/include to the lower case path variable would accomplish exactly ?

mydogisbox
Feb 21, 2012, 06:38 AM
What do you think adding /usr/include and /usr/local/include to the lower case path variable would accomplish exactly ?

Oh, hmmm. I should watch my capitalization.

KnightWRX
Feb 21, 2012, 06:49 AM
Oh, hmmm. I should watch my capitalization.

Capitalization aside, what do you think adding /usr/include and /usr/local/include to a properly capitalized PATH variable does ?

gnasher729
Feb 21, 2012, 07:29 AM
thank you, but what is the good idea ? I have no ideas to start (from the beginning ) . Any advices ?

Of course. Read my previous post, then spot this line:

"Why don't you start from the beginning and tell us what you are actually trying to do?"