Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7729 Discussions

Using GNU libstc++ to have std::filesystem with Intel Compiler

thrudprimrose
Beginner
654 Views

I am trying to compile a program that uses std::filesystem with Intel 19.1.2

since I could not configure the project, I decided to use gnu std library to have std::filesystem.

 

I tried to compile by loading both gcc (9.3.0) and intel compiler (19.1.2) and set the linker flag with:

add_link_options("-stdlib=libstc++")

 

as I have read it should link with the gnu stdlib, but I still get the error that

the c++ compiler does not support std::filesystem. How can I solve this?

0 Kudos
1 Solution
ShivaniK_Intel
Moderator
634 Views

Hi,

 

Thanks for reaching out to us.

 

We are unable to reproduce any error with Intel 19.1.2 using the below-attached sample program that uses std::filesystem. You can refer to the screenshot attached for the desired output.

Sample code:

 

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;

int main()
{
    std::cout << "Current path is " << fs::current_path() << '\n';
}

 

Command:

 

icpc sample_file.cpp -lstdc++fs -std=c++17
./a.out

 

So, Could you please provide the reproducer code to investigate more on your issue?

 

>>>Since I could not configure the project, I decided to use gnu std library to have std::filesystem.

 

Could you please let us know the issues you are facing while using Intel 19.1.2?

 

>>>I still get the error that the c++ compiler does not support std::filesystem.

 

Could you also provide the screenshot of the error and command-line you have used to reproduce it?

 

Thanks & Regards

Shivani

 

View solution in original post

3 Replies
ShivaniK_Intel
Moderator
635 Views

Hi,

 

Thanks for reaching out to us.

 

We are unable to reproduce any error with Intel 19.1.2 using the below-attached sample program that uses std::filesystem. You can refer to the screenshot attached for the desired output.

Sample code:

 

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;

int main()
{
    std::cout << "Current path is " << fs::current_path() << '\n';
}

 

Command:

 

icpc sample_file.cpp -lstdc++fs -std=c++17
./a.out

 

So, Could you please provide the reproducer code to investigate more on your issue?

 

>>>Since I could not configure the project, I decided to use gnu std library to have std::filesystem.

 

Could you please let us know the issues you are facing while using Intel 19.1.2?

 

>>>I still get the error that the c++ compiler does not support std::filesystem.

 

Could you also provide the screenshot of the error and command-line you have used to reproduce it?

 

Thanks & Regards

Shivani

 

thrudprimrose
Beginner
628 Views
-lstdc++fs

compiling with this linking flag solves the problem for me as well, so I am accepting it as an answer.

ShivaniK_Intel
Moderator
602 Views

Hi,


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards

Shivani


Reply