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

Discussion in 'C Programming' started by OtagoHarbour, Jan 8, 2012.

  1. OtagoHarbour

    OtagoHarbour Guest

    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
    OtagoHarbour, Jan 8, 2012
    #1
    1. Advertising

  2. OtagoHarbour <> writes:

    > 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.

    --
    http://www.greenend.org.uk/rjk/
    Richard Kettlewell, Jan 8, 2012
    #2
    1. Advertising

  3. In comp.lang.c OtagoHarbour <> wrote:
    > 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
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
    Jens Thoms Toerring, Jan 8, 2012
    #3
  4. OtagoHarbour

    Kaz Kylheku Guest

    On 2012-01-08, Richard Kettlewell <> wrote:
    > OtagoHarbour <> writes:
    >
    > 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.
    Kaz Kylheku, Jan 8, 2012
    #4
  5. Kaz Kylheku <> writes:
    > Richard Kettlewell <> wrote:


    >> OtagoHarbour <> writes:
    >>
    >> 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.


    Oh, yes, that makes more sense.

    --
    http://www.greenend.org.uk/rjk/
    Richard Kettlewell, Jan 8, 2012
    #5
  6. OtagoHarbour

    Jorgen Grahn Guest

    ["Followup-To:" header set.]

    On Sun, 2012-01-08, Jens Thoms Toerring wrote:
    > In comp.lang.c OtagoHarbour <> wrote:
    >> 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.


    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

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
    Jorgen Grahn, Jan 8, 2012
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pimousse
    Replies:
    2
    Views:
    3,633
    Roedy Green
    Apr 21, 2004
  2. Replies:
    5
    Views:
    917
    Axel Straschil
    Apr 6, 2005
  3. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    452
    SPE - Stani's Python Editor
    Apr 29, 2008
  4. OtagoHarbour
    Replies:
    5
    Views:
    339
    Jorgen Grahn
    Jan 8, 2012
  5. lubosp
    Replies:
    0
    Views:
    135
    lubosp
    Mar 28, 2008
Loading...

Share This Page