Intel® Software Guard Extensions (Intel® SGX)
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Cannot include certain header files in enclave project.

Nazmus_S_
Beginner
635 Views

Hello, everyone.

I am facing difficulty while trying to include certain header files in enclave project. For instance, the following statements result into a warning message (cannot open source file):

#include <malloc.h>

#include <atomic>

Although the application project can successfully include these header files, the enclave project fails to do so. Any idea?

Thanks.

 

 

0 Kudos
1 Solution
Juan_d_Intel
Employee
635 Views

Are you using the SGX SDK 1.7 release and the libc++ library?

Your enclave should include $(SGXSDKInstallPath)include\libc++ instead of $(SGXSDKInstallPath)include\stlport

View solution in original post

7 Replies
Juan_d_Intel
Employee
635 Views

Try including <stdlib.h> and <stdatomic.h>

Nazmus_S_
Beginner
635 Views

Hi Juan,

Thanks for your reply.

Is it possible to include standard C++11 headers like <atomic> in an enclave project?

Nazmus

Juan_d_Intel
Employee
635 Views

On Windows yes, because we support C++11.

The Linux SGX SDK doesn't support C++11 yet. However, there's a branch in github that shows a preliminary effort. It's not product quality though.

Nazmus_S_
Beginner
635 Views

Thanks for your response.

I am using Windows.

But, when I tried to include atomic header in an enclave project (#include <atomic>), I got an error "cannot open source file atomic".

Do I need to change any project configuration settings?

Nazmus

Anusha_K_Intel
Employee
635 Views

Hi,

I have used the same header file in my project and it is not showing any error. Which version of SGX and Visual studio are you using?

Juan_d_Intel
Employee
636 Views

Are you using the SGX SDK 1.7 release and the libc++ library?

Your enclave should include $(SGXSDKInstallPath)include\libc++ instead of $(SGXSDKInstallPath)include\stlport

Nazmus_S_
Beginner
635 Views

Thanks a lot Juan. It worked. Previously, I was using stlport in my enclave project.

Hi Anusha, I am using SGX SDK 1.7 and Visual Studio 2015 Professional.

Nazmus

Reply