Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Eclipse CDT Linux DNDEBUG

IKhai
Beginner
1,325 Views

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! 

0 Kudos
5 Replies
SergeyKostrov
Valued Contributor II
1,325 Views
>>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.
0 Kudos
SergeyKostrov
Valued Contributor II
1,325 Views
>>...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 ...
0 Kudos
Pavel_P_Intel
Employee
1,325 Views

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.

0 Kudos
IKhai
Beginner
1,325 Views

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!

0 Kudos
SergeyKostrov
Valued Contributor II
1,325 Views
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"
0 Kudos
Reply