Over-riding an error

  • Thread starter Brian Salter-Duke
  • Start date
B

Brian Salter-Duke

Ben, I would like to thank you for this post, which more than any of the
others is allowing me to work through this issue. This is complicated by
the fact that the overall code continues to fail, but the errors clearly
go back to this small C file. However, the shmat error is now fixed.

From your post and from others I now understand why icc gives a warning
but does not fail. It is just being more tolerant to old code. Thanks to
everyone for helping.

Brian.
 
R

Richard Bos

Brian Salter-Duke said:
I am trying to compile a large piece of Fortran code that interfaces in
a small piece of C code. For the C code compile:-

Compiling with the intel icc C compiler gives this warning:-

warning #159: declaration is incompatible with previous "shmat"
(declared at line 57 of "/usr/include/sys/shm.h")
char *shmat();
^

Compiling with gcc4 gives this error:-

error: conflicting types for 'shmat'
/usr/include/sys/shm.h:58: error: previous declaration of 'shmat'
was here

Others have helped you with the question you asked, which is how to
resolve the difference between these two declarations. But the question
which _should_ be asked is: why do you have two different declarations
of this function at all? If you only have the one declaration, in the
system header, you can never have a conflict between the correct
declaration and the user-added, wrong one. Trust on the declaration in
shm.h, and dike out the one on line 159 in whatever file declares it for
itself.

Richard
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top