- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I'm using an SD Card core in my SOPC builder system. In my Nios II IDE program I've included the associated header file. When I build the project I get the following error:
/cygdrive/c/altera/90/ip/altera_up_sd_card_avalon_interface/HAL/inc/altera_up_sd_card_avalon_interface.h:27: error: expected identifier before "false" In altera_up_sd_card_avalon_interface.h, line 27 there is the following code: typedef enum e_bool { false = 0, true = 1 } bool; what is the problem ? I guess there should be no problem with the header files included with the IP cores and we do not need to edit them!!!!!!!!!!! tnx in advance링크가 복사됨
9 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi moeen,
Probably your projects includes somewhere stdbool.h header, which already has bool type and true/false defined If you can't fix it, you can try adding the following undefs just before including the header with the typedef # undef false # undef true # undef bool- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Mmmm,
I tried to include the same typedef in one of my projects: I get the error but the undef trick works and it fixes it. Maybe you have different compiler settings. C++ support, Small C library, or any other similar options.- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I have chosen the small C library, could it be the problem? but unchecking it would need a very large amount of memory! :(
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Do you use c or c++?
In C++ false and true are parts of the language. In pure C thats not the case. if you use c++ try to place the offending header in something like this. extern "C" { #include "altera_up_sd_card_avalon_interface.h" }- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I believe the post creator has already resolved his issues, but, I had the same error and resolved it like this:
In altera_up_sd_card_avalon_interface.h, removed the line: typedef enum e_bool { false = 0, true = 1 } bool; Then, included stdbool.h. Problem solved! :)- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
tnx for ur guidace!It's been a long time since that problem and I solved it in a similar way. again tnx for ur help!:)
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I was stuck with the same error, saw the page but nothing. Then I finally solved it and thought I should post it here ;)