Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: c-code with Netbeans

c-code with Netbeans 6 years 3 months ago #9381

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi

I create some c-code with the tool Netbeans8.2

The problem is that the rt_errh.h generate
a preprocessor error

in the code:


#ifndef errh_Bugcheck
# if defined OS_ELN || defined OS_VMS
# define errh_Bugcheck(sts, str) \
(errh_Fatal("pwr bugcheck: <%s>, in file %s, at line %d\n", (str),__FILE__,__LINE__),(lib$signal(sts)))
# elif defined OS_POSIX
# define errh_Bugcheck(sts, str) \
(errh_Fatal("pwr bugcheck: <%s>, in file %s, at line %d\n%m", (str),__FILE__,__LINE__, sts),(exit(sts)))
# else
# error Platform not defined <<
# endif
# endif

If i make this line comment , it solves the problem


#ifndef errh_Bugcheck
# if defined OS_ELN || defined OS_VMS
# define errh_Bugcheck(sts, str) \
(errh_Fatal("pwr bugcheck: <%s>, in file %s, at line %d\n", (str),__FILE__,__LINE__),(lib$signal(sts)))
# elif defined OS_POSIX
# define errh_Bugcheck(sts, str) \
(errh_Fatal("pwr bugcheck: <%s>, in file %s, at line %d\n%m", (str),__FILE__,__LINE__, sts),(exit(sts)))
# else
# // error Platform not defined <<<<
# endif
# endif

Is there something wrong with this code????


cees
Last Edit: 6 years 3 months ago by seec.
The administrator has disabled public write access.

c-code with Netbeans 6 years 3 months ago #9382

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi cees,

OS_POSIX should be defined when you compile. Add -DOS_POSIX to the gcc command.

/Claes
The administrator has disabled public write access.

c-code with Netbeans 6 years 3 months ago #9383

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi claes

-DOS_POSIX

everything works on proview.
I just use Netbeans only for editing.
just to remove those red underlines in the editor

somewhere in Netbeans Tools- Options- C/C++ CodeAssistance -C-compiler or -C++compiler

I don't no where to put -DOS_POSIX in the netbeans setup?


cees
The administrator has disabled public write access.

c-code with Netbeans 6 years 3 months ago #9384

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
You can probably also add a

#define OS_POSIX 1

before the #include statements in your c-file.

/Claes
The administrator has disabled public write access.

c-code with Netbeans 6 years 3 months ago #9385

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi CLaes

Yes it works

put at the beginning in my c-code

#define OS_POSIX 1

Maybe shout it be better to insert it in the source code of
rt_errh.h at the beginning. This solve the red underline in this code also

#ifndef rt_errh_h
#define rt_errh_h

#define OS_POSIX 1

#ifndef pwr_h
# include "pwr.h"
#endif..........................



thanks anyway

cees
The administrator has disabled public write access.

c-code with Netbeans 6 years 3 months ago #9386

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi cees,

The idea is that the Proview code should be portable and compilable on different platforms. That's why the platform is sent with the compiler command and not hardcoded in the file.

/Claes
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 8.397 seconds