Error when compiling in gcc, expected identifier '(' before 'double'
I'm trying to compile the attached C code with
gcc -Wall -o nesta.o nesta.c
but I'm getting the following error:
nesta.c: At top level:
nesta.c:1004:15: error: expected identifier or ‘(’ before ‘double’
void restrict(double *coarse, double *fine,int imaxc,int jmaxc,int imaxf,int jmaxf)
As a side note, this is an old C program that used to work back in 1997.
nesta.c
praxis.h
c gcc include
add a comment |
I'm trying to compile the attached C code with
gcc -Wall -o nesta.o nesta.c
but I'm getting the following error:
nesta.c: At top level:
nesta.c:1004:15: error: expected identifier or ‘(’ before ‘double’
void restrict(double *coarse, double *fine,int imaxc,int jmaxc,int imaxf,int jmaxf)
As a side note, this is an old C program that used to work back in 1997.
nesta.c
praxis.h
c gcc include
3
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
1
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25
add a comment |
I'm trying to compile the attached C code with
gcc -Wall -o nesta.o nesta.c
but I'm getting the following error:
nesta.c: At top level:
nesta.c:1004:15: error: expected identifier or ‘(’ before ‘double’
void restrict(double *coarse, double *fine,int imaxc,int jmaxc,int imaxf,int jmaxf)
As a side note, this is an old C program that used to work back in 1997.
nesta.c
praxis.h
c gcc include
I'm trying to compile the attached C code with
gcc -Wall -o nesta.o nesta.c
but I'm getting the following error:
nesta.c: At top level:
nesta.c:1004:15: error: expected identifier or ‘(’ before ‘double’
void restrict(double *coarse, double *fine,int imaxc,int jmaxc,int imaxf,int jmaxf)
As a side note, this is an old C program that used to work back in 1997.
nesta.c
praxis.h
c gcc include
c gcc include
edited Nov 22 at 19:44
Jonathan Leffler
560k896651016
560k896651016
asked Nov 22 at 19:21
José Angel Neria Pérez
265
265
3
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
1
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25
add a comment |
3
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
1
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25
3
3
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
1
1
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25
add a comment |
1 Answer
1
active
oldest
votes
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437017%2ferror-when-compiling-in-gcc-expected-identifier-before-double%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
add a comment |
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
add a comment |
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
answered Nov 22 at 19:30
Jonathan Leffler
560k896651016
560k896651016
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437017%2ferror-when-compiling-in-gcc-expected-identifier-before-double%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Please show your code here directly, as a Minimal, Complete, and Verifiable example.
– Yunnosch
Nov 22 at 19:23
1
You've not granted permission in Google Drive to access the source you want us to help you with. This is not going to work. Please copy (a subset of) the source into the question. But, but the time you've created the MCVE, you may well have resolved your problem too.
– Jonathan Leffler
Nov 22 at 19:25