'mkstemp' was not decoded in this scope error on Cygwin

Asked 2 years ago, Updated 2 years ago, 73 views

Currently, Cygwin is installing a tool to solve C++-based partial differential equations called DUNE, but when I tried to build it, the following error occurred:

 'mkstemp' was not decoded in this scope

I checked and found that mkstemp is a Linux library call function, but could anyone tell me how to build a library containing files with this function defined in Cygwin?By the way, the Cygwin version is as follows.

CYGWIN_NT-10.0 A050946732 3.0.7 (0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin

c++ cygwin

2022-09-30 21:45

1 Answers

DUNE is based on , so I shouldn't have used fseko or mkstemp.In fact, dune-common-2.6.0.tar.gz found.-exec grep-n fseeko{}\; didn't hit anything (other than that) Is it different from the https://www.dune-project.org/ that the oira sees?

Cygwin 3.0.7 (0.338/5/3) passed the following program:The link also says #include<stdlib.h>.

$catmkstest.c
# include <stdlib.h>
int main() {
    char temp[] = "/tmp/mkXXXX";
    return mkstemp(temp);
}
$ gccmkstest.c
$ ./a.exe
$ ls/tmp
mkCCxxXft
$

#$dune-common-2.6.0/bin/dunecontrol all doesn't work, so I don't feel like pursuing it any more

dune-grid-2.6.0/dune/grid/io/file/dgfparser/dgfparser.cc separated by HAVE_MKSTEMP and std::tmpnam().

is this way, but according to man tmpnam,
https://ja.cppreference.com/w/cpp/io/c/tmpnam
tmpnam() doesn't just return a file name that doesn't seem to be covered, so other people can create a file with the same name at a critical time.You can manually remove the #defineHAVE_MKSTEMP1 line from config.h if you want to do so.

dgfparser.cc begins

#if HAVE_MKSTEMP
# include <unistd.h>
#endif

There is a line that says <stdlib.h> but <stdlib.h> on hpux 11.11 also indicates <stdlib.h>.So you can say that this is a bug on DUNE's side (although you may be using <unistd.h> for DUNE's reasons).

hpux 11.11 says that mkstemp() is old and should be fixed using tmpfile(), but the files created by tmpfile()std::tmpfile() are automatically deleted and cannot be used for permanent purposes.


2022-09-30 21:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.