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

How can I use inline functions with icx -O0

tmichio3
Beginner
444 Views

I want to compile with -O0 because debugging information is lost when optimization is performed.
That can be done with icc by adding the -finline option, but not with icx.

 

OK  :icc -finline -O0 main.c -o main -diag-disable=10441

 

NG :icx -finline -O0 main.c -o main
/usr/bin/ld: /tmp/main-da54d5.o: in function `main':
main.c:(.text+0x5): undefined reference to `abc'
icx: error: linker command failed with exit code 1 (use -v to see invocation)

 

0 Kudos
3 Replies
SeshaP_Intel
Moderator
394 Views

Hi,

 

Thank you for posting in Intel Communities.

 

Could you please add the "static" before inline in sub.h file? 

static inline int abc(void)

Using static keyword forces the compiler to consider this inline function in the linker.

You can refer to the below screenshot for the output.

Output.png

 

Thanks and Regards,

Pendyala Sesha Srinivas

 

0 Kudos
SeshaP_Intel
Moderator
352 Views

Hi,


Has the information provided above helped? If yes, could you please confirm whether we can close this thread from our end?


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
SeshaP_Intel
Moderator
312 Views

Hi,


We assume that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Reply