- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have been recently facing a problem which is I couldn't compile my program using c++ libraries in a nios2 application project. My gnu's version is 5.3.0. Also, I did research about it and found out that it supports c++11. I also checked inclusion of headers and found out that project>includes>C:/intelFPGA/18.1/nios2eds/bin/gnu/nios2-elf/include/c++/5.3.0 path that contains the headers I want to use is also included. In a simple code like;
#include <chrono>
#include <mutex>
int main()
{
std::mutex mtx;
return 0;
}
it says mutex is not a member of "std"
***
#include <chrono>
#include <thread>
int main()
{
std::this_thread::sleep_for(std::chrono::seconds(3));
return 0;
}
it says std::this_thread has not been declared and so on.
I got into the headers by ctrl+left click and there is an if check
#if __cplusplus < 201103L
#include <bits/c++0x_warning.h>
#else
....
here it thinks its cpp version is below c++11 beacuse it shows #else scope as black.
However, in makefile of the nios2 application project I added ALT_CXXFLAGS := -std=c++11 and APP_CFLAGS_USER_FLAGS := -std=c++11
I don't understand the problem could you please help me about that.
Best Regards,
Balerion
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Balerion,
Thank you for posting in Intel community forum and hope all is well.
Clarification on compilation failure, any error message that you are seeing for the failure?
That you further help us to understand the situation.
Also on the code mention what is trying to be included? Are those header files as they maybe an error in the syntax as well.
Note: As NiosII has been deprecated, you are advised to moved to NiosV
Best Wishes
BB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi BoonBengT,
Thanks for your answer. I simply try to use some libraries of c++ like <chrono> <cstdint> <mutex> <thread> etc. My previous message actually has some of the errors I face during compilation. Like "it says mutex is not a member of std", "std::this_thread has not been declared" and so on. However I include them in my code as it is seen in my previous code. I checked that if there is any syntax error or not. There is no syntax error. When I use C libs like "stdint.h" "math.h" etc it is getting compiled without any error. Also I add c++11 flags to makefile. ALT_CXXFLAGS := -std=c++11 and APP_CFLAGS_USER_FLAGS := -std=c++11 to this fields. The paths that contains c++ headers project>includes>C:/intelFPGA/18.1/nios2eds/bin/gnu/nios2-elf/include/c++/5.3.0 is also included. There is no way for it to not see these headers and allow me to use them . However When I got into the headers :
#if __cplusplus < 201103L
#include <bits/c++0x_warning.h>
#else
..........
This check fails. I don't know why but it fails. And I am not able to use these header files. You want me to do a specific thing in order to make you understand the problem? I'll consider moving to nios V by the way.
Best Regards,
Balerion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Balerion,
Noted on the intention to utilize some of the standard c libraries. By default the nios hal has included some of the standard library as part of the runtime env. (https://www.intel.com/content/www/us/en/docs/programmable/683282/current/c-standard-library-newlib.html)
Would suggest to use the more light weight version of those library as it would use less RAM, and below are some of the explanation of the limitation:
Note: there are also options available to create own custom/update the standard library . (https://www.intel.com/content/www/us/en/docs/programmable/683282/current/creating-a-custom-version-of-newlib.html)
Best Wishes
BB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Balerion,
Greetings, just checking in to see if there is any further doubts in regards to this matter.
Hope your doubts have been clarified.
Best Wishes
BB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Balerion,
Greetings, as we do not receive any further clarification/updates on the matter, hence would assume challenge are overcome. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. For new queries, please feel free to open a new thread and we will be right with you. Pleasure having you here.
Best Wishes
BB
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page