How to get source and header files - c

I am working on one full duplex communication project in that we requires files as:
#include <arpa/inet.h>,
#include <sys/socket.h>,
#include <netinet/in.h>
when I write program without these file I get error:
../development/src/../include/gxobjects.h:1604:14: error: field
'primaryDNSAddress' has incomplete type
IN6_ADDR primaryDNSAddress;
^~~~~~~~~~~~~~~~~ ../development/src/../include/gxobjects.h:1605:14: error: field
'secondaryDNSAddress' has incomplete type
IN6_ADDR secondaryDNSAddress;
^~~~~~~~~~~~~~~~~~~
when I declaree IN6_ADDR.
Please give me link from where I can get these files.

My search engine gave me as first result:
IN6_ADDR structure (in6addr.h)
My answer would be, that you have to include the in6addr.h header file.

I have One C code and want that code to transfer in Embedded C. I have problem in IP address. I just added all hex and source files in MPLAB X and It shows error as:
In file included from ../development/src/../include/objectarray.h:41:0,
from ../development/src/../include/dlmssettings.h:42,
from ../development/src/../include/apdu.h:36,
from ../development/src/apdu.c:37:
../development/src/../include/gxobjects.h:42:20: fatal error: in6addr.h: No such file or directory
#include<in6addr.h>
^
compilation terminated.
make[2]: *** [build/default/production/_ext/530717503/apdu.o] Error 255

Related

#INCLUDE "BOARD.H"

I got the following error when compiling a C file based on FreeRTOS through MCUXpresso IDE for LPC1769:
Invoking: MCU C Compiler
fatal error: board.h: No such file or directory
src/subdir.mk:24: recipe for target 'src/new.o' failed
#include "board.h"
Question:
Any idea, please?
Check for the location of board.h. It should be in the search path (current folder + system folder).
If board.h is in a different folder, consider adding -I/path/to/different/folder to the command line.

Linking md5.h library for HTTP Digest sample implementation

I am struggling to compile a simple C program from RFC 2617. The program is digtest.c and it uses digcalc.c, another file from the sample implementation. The latter one depends on two files that my compiler doesn't know about:
#include <global.h>
#include <md5.h>
At first I got this error:
digcalc.c:5:20: fatal error: global.h: No such file or directory
I resolved that by changing <global.h> to <stddef.h>, it seems. But I still get this error:
digcalc.c:7:17: fatal error: md5.h: No such file or directory
Now, md5.h seems to refer to the file found in libbsd. So I installed libbsd-dev and tried to compile the files like this:
gcc digcalc.c digtest.c -o digtest -L/usr/lib/x86_64-linux-gnu -lbsd
where /usr/lib/x86_64-linux-gnu is the location of libbsd.so and libbsd.a files. However, this does not resolve the last compilation error.
Could anyone point out what am I missing here?
Figured it out. Had to change <md5.h> to <bsd/md5.h>, as noted on libbsd page.
So instead of the original headers in digcalc.c:
#include <global.h>
#include <md5.h>
I used:
#include <stddef.h>
#include <bsd/md5.h>
Also had to change function stricmp to strcasecmp, its POSIX equivalent. After that the sample code compiled seamlessly.

Which header file do i need to include to have access to os_zalloc()?

I am trying to employ the function os_zalloc(), but can't seem to find which header file to include. According to a stackoverflow question: What is zalloc in embedded programming?, the definition should be given in mem.h. including mem.h without specifying a particular path gives the error:
test.c:1:17: fatal error: mem.h: No such file or directory
#include <mem.h>
I have a couple of files that claim they are mem.h. The two first files contain no data. While the next two files don't have os_zalloc() defined.
root#main:/# find / -name "mem.h"
usr/src/linux-headers-3.13.0-32-generic/include/config/infiniband/user/mem.h
/usr/src/linux-headers-3.13.0-32-generic/include/config/fix/earlycon/mem.h
/usr/src/linux-headers-3.13.0-32/arch/um/include/shared/mem.h
/usr/src/linux-headers-3.13.0-32/arch/mips/include/asm/mach-loongson/mem.h
Therefore, including any of these files in the program and compiling them with the specified path results in the error:
test.c:328: undefined reference to `os_zalloc'
collect2: error: ld returned 1 exit status
I have also tried to include memory.h. This works fine. But the function os_zalloc don't seem to be specified here either:
#include <memory.h>
The short question is that I would like to employ the function os_zalloc() but I can't seem to know what to include it (or if it even exist on my system). Does anybody have any suggestion?

Compiling icmp related codes under cygwin (missing "icmp" struct)

I'm using cygwin to compile a network tool(iffinder).
After ./configure and make i have a problem that i guess is related to struct icmp. Where is the icmp struct in header files. I searched for it in cygwin header files, but i didn't find anything.
How can i compile source codes which need icmp, in cygwin?
If it helps, you can find the source code of iffinder here
Note: I have ip_icmp.h in my cygwin's header files.
Compile error:
iffinder.c:1059: warning: "struct icmp" declared inside parameter list
iffinder.c:1059: warning: its scope is only this definition or
declaration, which is probably not what you want iffinder.c: In
function `handle_icmp_error': iffinder.c:1069: error: dereferencing
pointer to incomplete type
...
In cygwin, the icmp.h is empty. I suggest you copy a icmp.h from a open source project, and compile it with your project. Maybe, you have many errors and you have to correct them, but you just need an icmp struct and it will solve your problem.
iffinder.c line 54 does #include <netinet/ip_icmp.h> - is this header file present on your system?

how to solve errors like ‘struct iphdr’ has no member named ‘daddr’

I ran a program ( the link is - http://www.security-freak.net/raw-sockets/sniffer_eth_ip_tcp.c ) in my fedora core 5. On compilation , i get the following errors :
[root#localhost ~]# gcc sniffer_eth_ip_tcp.c
In file included from sniffer_eth_ip_tcp.c:12: /usr/include/linux/ip.h:97: error: expected specifier-qualifier-list before ‘uint8_t’
In file included from /usr/include/linux/tcp.h:21,
from sniffer_eth_ip_tcp.c:13:
/usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header; include <endian.h> instead!
sniffer_eth_ip_tcp.c: In function ‘ParseIpHeader’:
sniffer_eth_ip_tcp.c:147: error: ‘struct iphdr’ has no member named ‘daddr’
sniffer_eth_ip_tcp.c:148: error: ‘struct iphdr’ has no member named ‘saddr’
sniffer_eth_ip_tcp.c: In function ‘ParseTcpHeader’:
sniffer_eth_ip_tcp.c:185: error: ‘struct iphdr’ has no member named ‘protocol’
sniffer_eth_ip_tcp.c:187: error: ‘struct iphdr’ has no member named ‘ihl’
But , the struct iphdr in the corresponding header file contains the above mentioned data members.
can anyone please help..
The only way to get that error is if the iphdr your program is referring to does not include those data members. So, search through all your includes, check for dup's, etc. (also, you can run the source through a precompile and find out EVERYTHING that has been included, that usually provides your answer)
[edit]
run cpp on your source to find out which header files are included (in which order). If you have a header with the wrong information included before the correct information, you will have a problem. In essence, only include the header files necessary to compile the program
[/edit]

Resources