Re: Static Analyzer Problems
Re: Static Analyzer Problems
- Subject: Re: Static Analyzer Problems
- From: Andreas Grosam <email@hidden>
- Date: Wed, 02 Nov 2011 11:01:23 +0100
On Nov 2, 2011, at 8:59 AM, Dave wrote:
> Hi All,
>
> I still can't get this to work, the PCH file refuses to compile. This has only started happening since I changed the file types and I've changed them back and it still doesn't work.
>
> I'm really stuck on this now, if anyone has any ideas or suggestions please let me know.
>
> All the Best
> Dave
>
> --------------------------------------------------------------------------
>
> Hi,
>
> I tried changing the file types in the project settings and now it fails just doing a regular build. What should I set file type to?
Unless you know exactly what you are doing, use the default settings.
If you are unsure about the default settings, create a new project from a project template and compare.
>
> The error I get is on the precompiled header file as you say, the error is "Command /XCode3Developer/usr/bin/gcc-4.2 failed
>
> I check the path for it in the project settings and it is set to:
>
>
> /var /folders/u2/RANDOM-STRING/Caches/com.apple.xcode.501/SharedPrecompiledHeaders
>
> Is this correct? The .pch file is actually in the same folder as the project file.
You are probably confusing the "prefix file" with the "precompiled prefix header file". The latter is an output file generated by the compiler which format and structure is implementation defined.
The "prefix header" is an optional single file per target which contains a set of include directives. This is the input file for the precompile phase. Its extension is usually .pch.
(Note: the use of a prefix file is "compiler defined" - that is, it shall not be part of the source files of your project, rather a file that is specific to the "tool chain" you are using to compile that project. You are not forced to use precompiled headers, but it speeds up compilation times significantly.)
In the build settings, you can set the path name for the "prefix header" via "Precompile Prefix Header". The default is <target_name>/<target_name>-Prefix.pch (for Xcode 4.2. This may vary for Xcode 3.x)
The default is already good enough for most cases, except that the project sources should go into a separate folder, which may be located anywhere.
The default setting for the folder where the compiler will put the generated "precompiled prefix header file" is:
$(CACHE_ROOT)/SharedPrecompiledHeaders (again, for Xcode 4.2)
The default is also good enough, and you don't need to change this.
Related to this there are the following build settings:
"Precompile Prefix Header"
"Increase Sharing of Precompiled Headers"
(You can use Xcode's 4.2 Assistant Editor to get a brief description of each of the build settings or take a look in Xcode's Documentation, "Xcode Build Setting Reference" )
Regards
Andreas
>
> All the Best
> Dave
>
>
>
> On 29 Oct 2011, at 19:20, Christian Unger wrote:
>
>> just a wild guess:
>>
>> check the target settings for the precompiled header and see if it lives in the path that is declared there.
>>
>> cu
>> __
>> christian unger
>>
>>
>>
>> On 28.10.2011, at 10:44, Dave <email@hidden> wrote:
>>
>>> Hi All,
>>>
>>> I've inherited a Mac project that is a bit of a mess. The previous person (a Window's programmer) decided it was a good idea to develop a core "engine" (15 source files out of a total of 60) in C++ on windows and then move onto the Mac/XCode 3 and "bend" the project settings to suit it. Also where there is Objective-C code it doesn't conform to the Cocoa guide lines and some it has been made to "look" like C++, things like this:
>>>
>>> obj = [OBJECT alloc];
>>> obj = [obj init];
>>> [obj Construct];
>>>
>>> And in the init method:
>>>
>>> -(id) init
>>> {
>>> [super init];
>>>
>>> return self;
>>> }
>>>
>>> This project was developed using XCode 3 and I can't get it to compile under XCode 4. So I decided to stay with XCode 3. The project compiles and runs ok, but has 170 warnings. If I try to do a Build and Analyze I get the following error over and over on all the source files:
>>>
>>> Analyzer skipped this file due to parse errors
>>>
>>> fatal error: "/var/folders/u2/-RANDOM-STRING-/-caches-com.apple.XCode.501/SharedPrecompiledHeaders/LTW_MAC_Prefix-RANDOM-STRING/LTW_MAC_Prefix.pch" file not found
>>>
>>> I can't figure out why I should get this error since the project compiles ok. The only thing I can think of is that I think that the C++ code is reliant on GCC and the Analyzer uses LVM as far as I know? But why this should cause it to lose the precompiled headers file is beyond me.
>>>
>>> Any help on this and any advice/suggestions on how to proceed on this project would be gratefully appreciated. I obviously want to get rid of the C++ Code, but it is deeply entrenched in the rest of the objective-c UI (No MVC in this project!!).
>>>
>>> All the Best
>>> Dave
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden