implicit declaration of a function

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

implicit declaration of a function

Thomas Steinbach
Hello,

I don't understand why there is a message, which tells me
that there is an implicit declaration.

main.c:116: warning: implicit declaration of function `_fullpath'

get the same warnings if I use _splitpath, _makepath, etc.
I include the header file tchar.h, but don't understand that,
because in tchar these functions are declared.

I'm linking in extension to the standard libs, which are
automatically linked, the libs
-lshlwapi -luserenv -lcomctl32 -lws2_32 -liphlpapi

do I need to link an another lib for these functions? Which one?

btw: have the following headers inlcuded.

#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <io.h>

Thomas



------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: implicit declaration of a function

Keith Marshall
On Sunday 06 December 2009 22:04:46 Thomas Steinbach wrote:
> I don't understand why there is a message, which tells me
> that there is an implicit declaration.

Please provide a *minimal* and *self-contained* test case to
demonstrate the issue.

> main.c:116: warning: implicit declaration of function `_fullpath'
>
> get the same warnings if I use _splitpath, _makepath, etc.
> I include the header file tchar.h, but don't understand that,
> because in tchar these functions are declared.

According to MSDN, the correct header is stdlib.h, not tchar.h, but I
see that you later say that this is included anyway.

> I'm linking in extension to the standard libs, which are
> automatically linked, the libs
> -lshlwapi -luserenv -lcomctl32 -lws2_32 -liphlpapi
>
> do I need to link an another lib for these functions? Which one?

The warning message you are seeing has nothing to do with the
libraries with which you've chosen to link; it is telling you that
the function prototype is not in scope, when your source is
*compiled*, (long before any linking operation).

--

Regards,
Keith.

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: implicit declaration of a function

Thomas Steinbach
Hello Keith,

>> I don't understand why there is a message, which tells me
>> that there is an implicit declaration.
>
> Please provide a *minimal* and *self-contained* test case to
> demonstrate the issue.

ok. I placed a small example/test project at:
http://www.failure.bravehost.com/prog/mingw/fullpath/

the c code is just a simple call of _fullpath, but the get still
that warning. So I think there might be an error withing
my batch file or makefile. But cant't find an error.

Perhaps it's not important, because it's "only" a warning,
but there shouldn't be a warning.

just download and extract to any directory of your choice.
Execute mk_min3.bat after changing the vars %SHLLTOP%
to the top level (not bin) of your msys 1.0.11 installation and
the var %PATH2CC% to the top level dir of your mingw 3
installation. Then change the var $(PATH2CC) in the makefile
"makefile_min3"

Now it should successful compile.
(same procedure for mingw 4.x.x)

Remark: I never have the path to the compiler or the include/lib
environments vars in my default configuration, so I set them always
for an indiviual compiler in a batch, because I use more then just
the mingw 3.x or mingw 4.x compiler.

the mingw 3.4.5 installation is an installation of this packages:

binutils-2.20-1-mingw32-bin.tar.gz
expat-2.0.1-1-mingw32-bin.tar.gz
gcc-ada-3.4.5-20060117-3.tar.gz
gcc-core-3.4.5-20060117-3.tar.gz
gcc-g++-3.4.5-20060117-3.tar.gz
gcc-g77-3.4.5-20060117-3.tar.gz
gcc-java-3.4.5-20060117-3.tar.gz
gcc-objc-3.4.5-20060117-3.tar.gz
libexpat-2.0.1-1-mingw32-dev.tar.gz
libexpat-2.0.1-1-mingw32-dll-1.tar.gz
make-3.81-20090914-mingw32-bin.tar.gz
mingwrt-3.17-mingw32-dev.tar.gz
mingwrt-3.17-mingw32-dll.tar.gz
w32api-3.14-mingw32-dev.tar.gz
mingw-utils-0.4-1-mingw32-bin.tar.lzma

>> [...]
> According to MSDN, the correct header is stdlib.h, not tchar.h, but I
> see that you later say that this is included anyway.

Yes, my fault. I mean _tfullpath (tchar.h) which points to _wfullpath
and _fullpath, which are in stdlib.h

>> [...]
>> do I need to link an another lib for these functions? Which one?
>
> The warning message you are seeing has nothing to do with the
> libraries with which you've chosen to link; it is telling you that
> the function prototype is not in scope, when your source is
> *compiled*, (long before any linking operation).

ok, I see.

Hope that somone find my misstake.

Thomas


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: implicit declaration of a function

Tor Lillqvist
>> Please provide a *minimal* and *self-contained* test case to
>> demonstrate the issue.

> ok. I placed a small example/test project at:
> http://www.failure.bravehost.com/prog/mingw/fullpath/

The word "self-contained" meant that you should ideally provide a
single source file. Not a zip file with "project" with a lot of
irrelevant stuff including an already built executable. And "minimal"
meant that the less code, the easier it is for people to take a look
and help you, so including boilerplate headers from some
project-generating IDE or whatever that are larger than your actual
own source file is not really good when you expect people to help you.

But anyway, if you look in the header where _fullpath() is declared,
stdlib.h, you should notice that its declaration is inside

  #if !defined (__STRICT_ANSI__)

Your makefile_min[34] use the -std=c99 switch. See the connection?

--tml

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users