I want to make a module and the compilation stop at the beginning of the file compilation when asterisk.h is included.
It seems I forgot to install something to have this simple error but I don’t find what on the net !
My OS is a Ubuntu 22 and Asterisk 20.6
Here’s the error
gcc -Wall -g -I…/…/…/…/usr/src/asterisk-20.6.0/include -I…/…/…/…/usr/src/asterisk-20.6.0/include/asterisk -I/home/crebouw/projet/lib_noise_filter/ -I…/…/…/…/usr/include -I…/…/…/…/usr/include/arpa -c /home/crebouw/projet/lib_noise_filter/main.c -o obj/Debug/main.o
gcc -shared obj/Debug/main.o -o bin/Debug/lib_noise_filter.so
In file included from /usr/include/netinet/in.h:23,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/network.h:41,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/utils.h:26,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/alertpipe.h:22,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/channel.h:125,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/pbx.h:26,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/features.h:27,
from /usr/include/inttypes.h:25,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk/compat.h:30,
from …/…/…/…/usr/src/asterisk-20.6.0/include/asterisk.h:22,
from /home/crebouw/projet/lib_noise_filter/main.c:5:
/usr/include/x86_64-linux-gnu/sys/socket.h:24:14: error: expected ‘;’ before ‘typedef’
24 | __BEGIN_DECLS
| ^
| ;
Thank you anyone for your help
Jean-Luc
You can achieve this by using conditional compilation directives in your C code. Here’s the code :
`C#ifndef __asterisk_h
// Your module code here
// This code will be compiled only if asterisk.h is not included
#endif`
#ifndef __asterisk_h
: This directive checks ifasterisk.h
hasn’t been included yet.- If the condition is true (asterisk.h is not included), the code within the block will be compiled. This is where you can place your module code.
#endif
: This marks the end of the conditional compilation block.
This way, your code compilation will stop at the beginning if asterisk.h
is included. i hope it will solve your some problem.
Best Regard
Danish Hafeez | QA Assistant
ICTInnovations
Thank you Danish for your help.
In fact to solve the problem the software only has one line
#include “asterisk.h”
And the compilation has a problem in the call to asterisk.h!
Best regards
Jean-Luc
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.