you*_*his 1 c compiler-construction gcc warnings pointers
所以我收到了这个警告:
initialization makes integer from pointer without a cast
Run Code Online (Sandbox Code Playgroud)
在下面的代码中:
void receive(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *buffer)
{
const int one = 1;
int LEN = args; /* THIS IS THE LINE */
struct ipheader *ip;
struct tcpheader *tcp;
Run Code Online (Sandbox Code Playgroud)
说实话,小新手我不知道该怎么办,因为几乎所有的搜索都会返回makes pointer from integer
.
我也收到这些编译器消息:
/tmp/cci6u7NH.o: In function `main':
ChannelBunny.c:(.text+0x448): undefined reference to `pthread_create'
ChannelBunny.c:(.text+0x4b7): undefined reference to `pthread_join'
/tmp/cci6u7NH.o: In function `receive':
ChannelBunny.c:(.text+0xcb6): undefined reference to `nthol'
ChannelBunny.c:(.text+0xcdf): undefined reference to `nthol'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
通过使用摆脱了类似的pcap问题,-l pcap
但这对其他两个不起作用.它刚刚回来:
gcc: pthread: No such file or directory
gcc: nthol: No such file or director
Run Code Online (Sandbox Code Playgroud)
我猜我要下载一些东西?还是我必须使用另一个命令.(我正在使用Backtrack5,如果对你有用的话).
你应该做
int LEN = *args;
Run Code Online (Sandbox Code Playgroud)
args是一个指针,*args是它指向的值.此外,您不应该将u_char放入int中.
对于nthol:http://msdn.microsoft.com/en-us/library/windows/desktop/ms740069( v = vs.85).aspx