Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
12485 Discussions

How to set compiler flag (-fpermissive) in eclipse?

Honored Contributor II

Hello everybody, I have a beginner question: 


I would like to mix signed and unsigned char types. 

Therefore I would like to know how to set the fpermissive flag. 

I have tried different approaches, none of them give the result i would like to have: 


-> properties of .cpp file, go to paths and symbols,# symbols, select GNU C++, add fpermissive value (none or value 1) 


-> properties of project entire project: do the same 


-> properties of .bsp: do the same. 


-> properties of C/C++ build, build variables, fpermissive, value 1 


The strange thing is that if i go through a find in files (simple and tried out find in files with microsoft visual studio), i do see that the settings have been added to the .cproject but are not in the makefile. It is possible that it is passed through the ALT_CPPFLAGS_DEFINED system variabele, but the detailed mechanism behind, i do not know. 


I aslo do not know what steps to take to activate the changed settings, is a clean and rebuild of the project ok, or are there other steps to be taken? 


Would anybody please be so kind to explain in detail how i can set the fpermissive flag (and others)? 


Best Regards, 

0 Kudos
5 Replies
Honored Contributor II

I would start with nios2-bsp-editor. Look for Advanced >> hal >> make >> bsp_cflags_user_flags under the main tab. You should be able to add your flag there.

Honored Contributor II

Hello, Mikedsouze, 

Thank you for looking into my question and for your answer. 

I tried your advice, but, unfortunately, it did not give the expected result. 

I was able to implement the setting for the compilation of the BSP package. 

I got the correct message: "cc1.exe: warning: command line option '-fpermissive' is valid for C++/ObjC++ but not for C" during the compilation of the bsp package. 

However, when i compiled my main (.cpp) program, the original message was still there.  

My conclusion would be that the modified settings are valid for the .bsp compile but not for the main project. 


Are there any other suggestions to solve this issue?  

Did I interpret or implement your solution not as it was intended ? 


Best Regards, 

Honored Contributor II

I think you will also need to modify the APP_CFLAGS_USER_FLAGS to include the flag for your application. You should be able to find it in the Makefile of your main program folder.

Honored Contributor II

Hello Everybody, Hello Mikedsouze, 


Thanks for your reply, it crossed the result of my own experiments: 


I found a solution but it might be not 100% the correct (intended) way to do things: 


I opened the makefile for the project in the "software\<application name>" subdirectory and modified the makefile by hand. 

# Common arguments for ALT_CFLAGSs 






APP_CFLAGS_USER_FLAGS := -fpermissive 


Then it worked: my code compiles with a warning instead of an error. 


Could anybody please tell me if this is the correct (only) way to do things? 


Can you make modifications in the makefile without the risk that the wizards / templates implemented by Altera get compromised? 


Best regards, 

Honored Contributor II

That is what I told you in my previous comment. That is the way to do it as far as i know.