fcntl2.h:51:26 error with NetBeans IDE 7.0.1 on Ubuntu 11.08

O

OtagoHarbour

I am using NetBeans IDE 7.0.1 to build a C++ application on Ubuntu
11.08.

I have code written in C++ and it builds fine in Debug mode. However,
when I try to build it in Release mode I get the following errors.

/usr/include/i386-linux-gnu/bits/fcntl2.h:51:26 error: call to ' open
missing mode' declared with attribute error: open with O_CREAT in
second argument needs 3 arguments.

I have the following definition files included.

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

I duplicated the properties for the Debug build and renamed the
duplicate Release so it built perfectly just like the Debug version.
Then I went to the C++ compiler and changed
Basic Options: Development Mode from Debug to Release. That was what
caused the problem with fcntl.h

Any assistance with fixing this problem would be greatly appreciated.

Thanks.
Peter
 
R

Richard Kettlewell

OtagoHarbour said:
I am using NetBeans IDE 7.0.1 to build a C++ application on Ubuntu
11.08.

I have code written in C++ and it builds fine in Debug mode. However,
when I try to build it in Release mode I get the following errors.

/usr/include/i386-linux-gnu/bits/fcntl2.h:51:26 error: call to ' open
missing mode' declared with attribute error: open with O_CREAT in
second argument needs 3 arguments.

I have the following definition files included.

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

I duplicated the properties for the Debug build and renamed the
duplicate Release so it built perfectly just like the Debug version.
Then I went to the C++ compiler and changed
Basic Options: Development Mode from Debug to Release. That was what
caused the problem with fcntl.h

Any assistance with fixing this problem would be greatly appreciated.

The message looks fairly straightforward; check that your call(s) to
open() are correct. The checking version is only defined conditionally
which presumably explains why you only see the error in certain
configurations.
 
J

Jens Thoms Toerring

In comp.lang.c OtagoHarbour said:
I am using NetBeans IDE 7.0.1 to build a C++ application on Ubuntu
11.08.

I would guess that it's either Ubuntu 11.04 or 11.10, there is
no 11.08 vaersion. And if you write on C++ it would also seem
to be preferable to ask in the C++ nwesgroup, comp.lang.c++.
I have code written in C++ and it builds fine in Debug mode. However,
when I try to build it in Release mode I get the following errors.
/usr/include/i386-linux-gnu/bits/fcntl2.h:51:26 error: call to ' open
missing mode' declared with attribute error: open with O_CREAT in
second argument needs 3 arguments.
I have the following definition files included.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

Obviously this is a Unix related problem, since there is no
open() function in either stamdard C or C++, thus a better
place to ask would be e.g. comp.unix.programmer. But what
you have to do seems rather clear: for some reasons the
the compiler gets passed some flags in "release" mode that
aren't set in "debug" mode and which result in some extra
checks being done (I would suspect that in "debug" mode the
-O0 flag is passed to the compiler to disable optimizatation,
but that also makes the detection of certain potential pro-
blems impossible). And with those extra flags it detects that
in some place in your code open() is called with 'O_CREAT'
being set in the second argument and there's no third argu-
ment, which in this case is required. The only reasonable fix
for that is to go to the places in your code where open() is
used and misses the required third argument (the exact plave
is rather likely shown in the error message from the compiler
just before the line you cited) and fix that. It's rather
likely that your program will exhibit rather strange behaviour
if you don't do so (at least the permission flags for the file
might be set randomly, which isn't a good thing at all).

Regards, Jens
 
K

Kaz Kylheku

The message looks fairly straightforward; check that your call(s) to
open() are correct. The checking version is only defined conditionally
which presumably explains why you only see the error in certain
configurations.

These checks are done in the body of an inline version of open which calls an
appropriate variant based on what arguments are present. I'm guessing that
these checks get hoisted into compile time under optimization.
 
R

Richard Kettlewell

Kaz Kylheku said:
These checks are done in the body of an inline version of open which calls an
appropriate variant based on what arguments are present. I'm guessing that
these checks get hoisted into compile time under optimization.

Oh, yes, that makes more sense.
 
J

Jorgen Grahn

["Followup-To:" header set.]

I would guess that it's either Ubuntu 11.04 or 11.10, there is
no 11.08 vaersion. And if you write on C++ it would also seem
to be preferable to ask in the C++ nwesgroup, comp.lang.c++.





Obviously this is a Unix related problem, since there is no
open() function in either stamdard C or C++, thus a better
place to ask would be e.g. comp.unix.programmer.

He's already crossposting to comp.os.linux.development.apps which is
probably a better place since the problem is with gcc and/or glibc.
Followup-to set.

It's probably also a good idea for the OP to explain what "Debug" and
"Release" means precisely, in terms of compiler options. Most Linux
people don't use that IDE (or a Visual Studio-style Debug/Release
dichotomy, for that matter).

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top