Hi,
I'm trying to do some network programming, but when I use 'struct
addrinfo' or getaddrinfo, I see errors:
[ ~/src/_sandbox] gcc --std=c99 -Wall ipv6_test.c -o it
ipv6_test.c: In function `main':
ipv6_test.c:25: error: storage size of 'hints' isn't known
ipv6_test.c:34: warning: implicit declaration of function
`getaddrinfo'
ipv6_test.c:38: error: dereferencing pointer to incomplete type
ipv6_test.c:39: error: dereferencing pointer to incomplete type
ipv6_test.c:40: error: dereferencing pointer to incomplete type
ipv6_test.c:41: error: dereferencing pointer to incomplete type
ipv6_test.c:49: error: dereferencing pointer to incomplete type
ipv6_test.c:49: error: dereferencing pointer to incomplete type
ipv6_test.c:49: error: dereferencing pointer to incomplete type
ipv6_test.c:56: warning: implicit declaration of function
`gai_strerror'
ipv6_test.c:56: warning: format argument is not a pointer (arg 4)
ipv6_test.c:71: error: dereferencing pointer to incomplete type
ipv6_test.c:71: error: dereferencing pointer to incomplete type
ipv6_test.c:77: warning: implicit declaration of function
`freeaddrinfo'
ipv6_test.c:25: warning: unused variable `hints'
However, it builds fine when I remove --std-c99
Does anyone know the reason for this?
Thanks,
Nathan 3 8278
On 18 Jun 2008 at 18:54, Nathan wrote:
I'm trying to do some network programming, but when I use 'struct
addrinfo' or getaddrinfo, I see errors:
[snip]
ipv6_test.c:34: warning: implicit declaration of function `getaddrinfo'
[snip]
ipv6_test.c:56: warning: implicit declaration of function `gai_strerror'
[snip]
ipv6_test.c:77: warning: implicit declaration of function `freeaddrinfo'
You're probably not including the reqired headers. Try
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
On Wed, 18 Jun 2008 20:17:21 +0000, Antoninus Twink wrote:
On 18 Jun 2008 at 18:54, Nathan wrote:
>I'm trying to do some network programming, but when I use 'struct addrinfo' or getaddrinfo, I see errors:
[snip]
>ipv6_test.c:34 : warning: implicit declaration of function `getaddrinfo'
[snip]
>ipv6_test.c:56 : warning: implicit declaration of function `gai_strerro r'
[snip]
>ipv6_test.c:77 : warning: implicit declaration of function `freeaddrinf o'
You're probably not including the reqired headers. Try
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
The OP probably is including the required headers, or the compiler would
also have complained without the --std-c99 option. The answer is simply
that getaddrinfo is not a C99 function, and is therefore not declared by
the library when asking for a C99 implementation.
On 18 Jun 2008 at 20:37, Harald van Dijk wrote:
The OP probably is including the required headers, or the compiler would
also have complained without the --std-c99 option. The answer is simply
that getaddrinfo is not a C99 function, and is therefore not declared by
the library when asking for a C99 implementation.
I think you're right. That seems like a terrible misfeature of gcc. If I
have a C program and I include a POSIX header, I damn well want the
functions from that header, in just the same way as if I include my own
header file then I want access to those functions, without the compiler
getting all holier-than-thou and telling me my functions aren't
mentioned in the C standard.
One solution is to add -D_POSIX_C_SOURC E=200112L as a command-line
option. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Minor Crank |
last post by:
Sorry for the silly newbie question.
Our manager has directed us to use the getaddrinfo() instead of the
deprecated gethostbyname().
The problem is, I don't know where getaddrinfo() get its address
information. It seems to ignore entries placed in the hosts table.
Help!
|
by: run |
last post by:
My enveronment
- IE6
- .Net 1.1 sp1
- Windows 2000 sp4
I cannot use function "CSMTPConnection" on Vc++.Net on Windows 2000.
because WS2_32.dll on error message as "The procedure entry point
getaddrinfo could not be located in the dynamic link library
WS2_32.dll". How i can updated winsock new version on windows2000?
I want to execute file.
|
by: Vidyasagara Guntaka |
last post by:
Hi,
I recently downloaded source code for 8.0.0 beta1. When I tried building the libpq for windows, I got some compilation errors. Following the compilation output:
C:\temp\postgresql-8.0.0beta1\src>nmake /f win32.mak
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
cd include
if not exist pg_config.h copy pg_config.h.win32 pg_config.h
|
by: edcdave |
last post by:
I'm trying to get MoinMoin 1.5.4 running with Python 2.3.4 (installed
from an SCO Skunkworks binary). Python 2.3.4 (#1, Aug 27 2004,
18:22:39) on sco_sv3
One of the MoinMoin modules attempts to import cgi and triggers this
traceback:
Traceback (most recent call last):
File "./moin.cgi", line 43, in ?
from MoinMoin.request import RequestCGI
|
by: mirandacascade |
last post by:
I noticed the following lines from the connect() method of the
HTTPConnection class within httplib:
for res in socket.getaddrinfo(self.host, self.port, 0,
socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
This led me to the docs that describe the socket.getaddrinfo() method:
http://www.python.org/doc/2.4.1/lib/module-socket.html
| |
by: Thomas Dybdahl Ahle |
last post by:
Hi, I'm writing an application that connects to the internet.
Something like this:
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
self.sock = socket.socket(af, socktype, proto)
Now if the user press the cancel button, I'd like the connection to
imidiatly stop. I run
|
by: John Nagle |
last post by:
Here's a strange little bug. "socket.getaddrinfo" blows up
if given a bad domain name containing ".." in Unicode. The
same string in ASCII produces the correct "gaierror" exception.
Actually, this deserves a documentation mention. The "socket" module,
given a Unicode string, calls the International Domain Name parser,
"idna.py", which has a a whole error system of its own. The IDNA
documentation says that "Furthermore, the socket...
|
by: Eric Lilja |
last post by:
Hello, consider this program:
class Outer
{
public:
class Base
{
friend class Outer;
public:
Base(int n) : n_(n) {}
protected:
|
by: Karl Chen |
last post by:
I've discovered that since glibc 2.3.2, getaddrinfo(3) supports a
useful flag called AI_ADDRCONFIG. It turns off AAAA lookups if
the machine isn't configured for IPv6 (and similarly for IPv4,
theoretically). This is especially important when behind gateways
whose DNS forwarder silently filter AAAA requests. Without
AI_ADDRCONFIG, every DNS request has to wait for 4 AAAA request
timeouts before it even attempts an A request.
Passing...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |