On Tue, Nov 02, 2010 at 07:09:10PM -0400, Robert S. Kissel wrote:
> On Wed, Oct 27, 2010 at 6:54 AM, Michal Hocko <[email protected]> wrote:
> > compile the following program:
> > test.c
> > ===
> > #include <stdlib.h>
> > int main()> {mkstemp(NULL);return 0;}
> > ===
> > Try the following tests:
> >[1] gcc -o test test.c
> >[2] g++ -o test test.c
> >[3] gcc -o test -posix test.c
> >[4] g++ -o test -posix test.c
> >[5] gcc -o test -posix -std=c99 test.c
> >[6] g++ -o test -posix -std=c++98 test.c
> >[7] gcc -o test -posix -std=c99 -ansi test.c
> >[8] g++ -o test -posix -std=c++98 -ansi test.c
> 
> Tests [1], [2], [3], [4] 

Sounds good

> and [7] compile without complaint, and

I am little bit confused by this because I thought that -std parameter
makes a difference but here it looks like -ansi actually do. If you
remember the last attempt we tried to remove -ansi to make thingy
work...

> produce an executable which dies at once with a segmentation fault
> when I run it (I can show you the core dump if you're interested).

Crash is to be expected. This is just a compile test not a real program.
mkstemp is not prepared to be called with NULL parameter.

> 
> Test [5] spits out the same warning you reported, viz.,
> test.c: In function `main':
> test.c:4: warning: implicit declaration of function `mkstemp'
> and then builds an executable which dies like the others.

OK so at least for C compiler we are on the same boat.

> 
> Tests [6] and [8] spit out the error I was seeing when I tried to
> compile gfile.cc as part of building pdfedit:
> test.c: In function `int main()':
> test.c:4: error: `mkstemp' was not declared in this scope

Hmm that looks like some mess in cygwin headers wrt. C++ standard vs. C. 
Anyway, could you try to add -D_XOPEN_SOURCE=500 to the tests command
line:
g++ -o test -D_XOPEN_SOURCE=500 -posix -std=c++98 test.c
g++ -o test -D_XOPEN_SOURCE=500 -posix -std=c++98 -ansi test.c

This additional parameter removes the warning from [5] and in fact
should be used for compatibility mode (see man mkstemp). If this works
for you then try to add this parameter to Makefile.flags (for both
variables CONFIG_CFLAGS and CONFIG_CXXFLAGS) and try to compile pdfedit
again (without running configure).


-- 
Michal Hocko

------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware, 
phishing sites, and compromised hosts - saving your company time, 
money, and embarrassment.   Learn More! 
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to