Eclipse CDT Linux DNDEBUG

Eclipse CDT Linux DNDEBUG

Hi,

I try to use macros for assert on release build configuration.

I want to add #define NDEBUG each time I build a release.  I went to project properties -> paths and symbols and under symbols added the NDEBUG.

When I compile using Intel compiler it dosn't have any affect but when I use gcc it works.

Can anybody tell me what is the reason for the behaviour?

Thanks! 

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

>>When I compile using Intel compiler it dosn't have any affect but when I use gcc it works.
>>
>>Can anybody tell me what is the reason for the behaviour?

I use a -DNDEBUG option for a GCC-like C++ compiler to build Release configuration and it works. I think you need to verify your project settings because -D is too fundamental and it is hard to believe that Intel C++ compiler has a problem with it.

>>...Can anybody tell me what is the reason for the behaviour?

Could you post a complete command line for the compiler? Another question is do you use -g option for the Release comfiguration?
...
-g - Generate debug information in default format
...

Hello,

First of all, thank you for using our products!

I tried to reproduce the case you have described, but everything works well. I've created a new project with Intel toolchain selected, and specified an NDEBUG symbol in "paths and symbols" for Release configuration. Additionally I've added a TEST symbol for both configurations.

Here is my debug build output:

make -k all
Building file: ../main.c
Invoking: Intel IA-32 C Compiler
icc -g -DTEST -MMD -MP -MF"main.d" -MT"main.d" -c -o "main.o" "../main.c"
Finished building: ../main.c

And release build:

make -k all
Building file: ../main.c
Invoking: Intel IA-32 C Compiler
icc -g -DNDEBUG -DTEST -MMD -MP -MF"main.d" -MT"main.d" -c -o "main.o" "../main.c"
Finished building: ../main.c

Note, that GCC and Intel toolchains has different containers for symbols: GNU C and C Source File. So if you will add an entity to the symbol list of GCC toochain it will be unavailable from Intel toolchain. Could you make sure that you have added your symbols into Intel's toolchain?

If the issue is still exist could you provide more information about it, actual command line, compiler version and etc.?

Thanks,

--Pavel.

Hi all,

Thank you for your help!

The problem has been migration from linux to windows projects. The configuration is slightly different since I use MiniGW on windows.

Pavel, I double checked your symbols. All works fine all both systems.

Thanks a lot!

I would like to note that for Release configuration of some project options -g and DNDEBUG are contradicting. As I already mentioned:
...
-g - Generate debug information in default format
...

Here is the question: Why does anybody need some debug information in Release configuration?

For example, in case of a MinGW C++ compiler I use the following set of options for Release configuration:

-O2 -m32 -msse3 -ffast-math -I "../Composer XE/Mkl/Include" -B "../Apps/Include" -DNDEBUG -o Release/MgwTestApp.exe MgwTestApp.cpp "../Composer XE/Mkl/Lib/Ia32/mkl_rt.lib"

Leave a Comment

Please sign in to add a comment. Not a member? Join today