Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Cannot include certain header files in enclave project.

Nazmus_S_
Beginner
1,180 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
1,180 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

0 Kudos
7 Replies
Juan_d_Intel
Employee
1,180 Views

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

0 Kudos
Nazmus_S_
Beginner
1,180 Views

Hi Juan,

Thanks for your reply.

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

Nazmus

0 Kudos
Juan_d_Intel
Employee
1,180 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.

0 Kudos
Nazmus_S_
Beginner
1,180 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

0 Kudos
Anusha_K_Intel
Employee
1,180 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?

0 Kudos
Juan_d_Intel
Employee
1,181 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

0 Kudos
Nazmus_S_
Beginner
1,180 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

0 Kudos
Reply