Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,187 Views

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

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, 

John.
0 Kudos
5 Replies
Highlighted
Valued Contributor III
55 Views

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.

0 Kudos
Highlighted
Valued Contributor III
55 Views

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, 

John.
0 Kudos
Highlighted
Valued Contributor III
55 Views

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.

0 Kudos
Highlighted
Valued Contributor III
55 Views

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_DEFINED_SYMBOLS := 

APP_CFLAGS_UNDEFINED_SYMBOLS := 

APP_CFLAGS_OPTIMIZATION := -O0 

APP_CFLAGS_DEBUG_LEVEL := -g 

APP_CFLAGS_WARNINGS := -Wall 

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, 

Johi.
0 Kudos
Highlighted
Valued Contributor III
55 Views

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

0 Kudos