Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Receiving warning: implicit function declaration: memset

807575Aug 3 2006 — edited Aug 4 2006
We have the Sunstudio 11 compiler: Sun C 5.8 2005/10/13 and I created a C program and am receiving the above message:

include <stdio.h>
#include <stdlib.h>

/*
*
*/
int
main(int argc, char** argv)
{
char formatString[200];

memset(formatString, 0, sizeof(formatString));
if (argc != 2)
{
fprintf(stderr, "Usage: %s: argument\n", argv[0]);
return (1);
}

sprintf(formatString, "Hello %s, from old hello world program", argv[1]);
printf("%s\n", formatString);
return (EXIT_SUCCESS);
}

When I compile, I receive
"warning: implicit function declaration: memset". I also have code that uses strcpy and strcmp and I receive:
warning: implicit function declaration: strcpy
warning: implicit function declaration: strcmp

When I compile with Workshp 6.2, this warning does not occur. This problem is a prototype issue. In Workshop 6.2, this was resolved if the string.h was not included. The compiler searched until it found the correct header. Is there a way to get the compiler to do what Workshop did?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2006
Added on Aug 3 2006
3 comments
816 views