Am attempting to port some C programs from Linux system over to Windows 7 Ultimate 64.
These compile and run without error on newest GNU C, Fedora 12.
I receive the following errors for the following "primitive calls":
Missing prototype for 'write'
Missing prototype for 'creat'
Missing prototype for 'close
I am unable to locate the correct include file.
Current I am using:
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
Thank you
Frank
From help:
Syntax:
int _creat(const char *name, int mode);
Declared in:
<io.h>
<fcntl.h> (macros)
Use compiler option 'Define compatibility names' -Go
thanks for the assistance.
Tried adding io.h and this did not fix things.
Is this syntax inside "main" still valid?:
fd=open(d_file_nam, O_BINARY|O_CREAT);
if (fd <= 0)
{
printf("Could not create beam data outfile %s, exiting!\n", d_file_nam);
};
Also, what is the meaning of the compiler instruction you suggested in this case?
Frank
If you are using POIDE:
From menu Project -> Project options... -> Tab Compiler and check option Define compatibility names.
This insert compiler option -Go to project file.
Or insert that option -Go to compilers commandline.
Quote from: duffyfr on March 14, 2010, 06:24:43 PM
Also, what is the meaning of the compiler instruction you suggested in this case?
You use open(), but the function actually is
_open().
Setting the compiler to use compatibility names will allow you to use
open() without the leading underscore in your code.
Thanks for the great information and, of course, it works!
As a researcher I end up programming in C every 2 years or so to facilitate a string of analyses and I always seem to end getting caught in new "standards".
(1) What is the best resource to find my own answers to issues like open() (which is portrayed like this in nearly every text) and _open().
(2) does the preceding "_" signify that this is an externally defined variable?
(3) I tried hard to find out why the function "strcasecmp()" is not now recognized but ran across a possible answer:
#define strcasecmp _stricmp but is there no a standard/updated place to search for answers to such apparent changes in C?
(4) Specifically if I have an externally defined function, how can I easily determine the latest and correct/defining include file?
Thanks again.
Frank
Questions 1 to 3 can be answered by reading the help file, which describes the C standard used and the functions differing from the used C standard, which are usually preceded by an underscore.
For question 4 you will have to look the function up at the MSDN Library (http://msdn.microsoft.com/en-us/library/default.aspx) or the development kit homepage of the third-party DLL you use.
Thank you all for your help!
I conclude at this point.
Frank
In oldnames.lib are _strcasecmp and _strncasecmp.
With this Add-In you can list functions from oldnames.lib
http://forum.pellesc.de/index.php?topic=1079.0 (http://forum.pellesc.de/index.php?topic=1079.0)
Attachment: OldNames.lst