Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icc cannot find header file

Aman_J_
Beginner
1,068 Views

Hello all,

I am new with Intel's C++ Compiler and probably this is a noob question that's been asked before. I am having trouble building my code in Xcode (v5.1.1) using ICC (ICC XE 15.0), which builds fine with LLVM Compiler. When I try to build my project using ICC, I get a load of "catastrophic error: cannot open source file "my_header_file.h"". Now with Xcode I clearly tell what the working directory is because when I created the project file, this was required because LLVM couldn't find the header files either, but once it knew about the working directory it just looked for all the folders in which my source code is and it found the header files.

Strangely enough, if I put the absolute path of the header files instead of "my_header_file.h", ICC finds it and doesn't complain. So what I don't understand is how to tell ICC about the working directory through Xcode. Typically this is done by going in Edit Scheme > Options > Working Directory and tick the "Use custom working directory", but it seems that when I use ICC that information doesn't get through, somehow. I configure ICC in the Build Rules by setting Process to "C++ source files" and Using to "ICC Intel C++ Compiler XE 15.0" but that doesn't help.

So my question is : is there some special variable or parameter that I need to fill in so that ICC can understand what the working directory is ? I use Xcode 5.1.1, ICC XE 15.0 and OS X version is 10.9.4.

Thanks in advance for your time,

0 Kudos
2 Replies
VERA_F_Intel
Employee
1,068 Views

Hello Aman J.

I can not reproduce it. Could you describe in detail your actions and the scheme of the working directory? If possible, please attach a Xcode project.

My steps:

Created new project. main.c:
  #include "h1.h"
  #include "h2.h"

Created two these headers in different locations. Scheme of workdir:
  myproject.xcodeproj
  myproject/main.c
  myproject/h1.h
  myproject/headers/h2.h


Tried to build with ICC and LLVM:
(1) I added these headers via "Add Files to project.." - build succeeded: headers were found
(2) I deleted headers (only references) from project - build failed: h1.h was found (because in directory with main.c), h2.h - wasn't
(3) Set value "-I/<full_path>/myproject/headers" in Build setting -> "Additional C options" for ICC compiler - h2.h was found also.

0 Kudos
Aman_J_
Beginner
1,068 Views

Hello VERA F.,

Actually I think I have found the way to get icc to understand that I want it to look into the different folders where my source code is. In Xcode, in the Build Settings of the Project there is an option under "Search Paths" called "Always Search User Paths", which was originally set to No, but I set it to Yes. So what I did was : Build Settings > Search Paths > Always Search User Paths > Yes (was initially No)

This had the effect of icc finding the various header files in my code and now my project builds successfully. I knew there was something that Xcode wasn't doing and at least this did the trick.

I am still getting to grips with icc, it will all come together eventually. I am still having some issues running the code because of some library, I get messages saying "library not loaded: libiomp5.dylib" but after Googling it I found that this seems to be a fairly common symptom so again I will just have to find how to get Xcode to load this library and then I'll be set to do some real work and see what ICC can or can't do. Thank you for your time VERA F., I hope the information I provided here is useful.

0 Kudos
Reply