Compilation error C: Id returned 1 exit status

For some reason, when I try to compile the program, the compiler says that permission is denied, and Id returned 1 exit status. Can someone tell me what that means? thank you

#include <stdio.h> /* Library inclusions */ #include "genlib.h" #include "simpio.h" int binSearch(int val, int numbers[], int size1); /* prototypes */ void sortArray (int numbers[], int size1); int indexMax (int numbers[], int low, int high); void swap (int numbers[], int loc, int loc1); void getArray (int numbers[], int size1); void displayArray (int numbers[], int size1); main() { int value, size1; printf("Enter the number of elements: "); size1=GetInteger(); int numbers[size1]; getArray(numbers, size1); sortArray(numbers, size1); displayArray(numbers, size1); printf("\nEnter value to find: "); value=GetInteger(); binSearch(value, numbers, size1); getchar(); } void sortArray (int numbers[], int size1) /*Function sortArray*/ { int i , maxInd; for (i= size1-1; i>=0;i--) { maxInd=indexMax(numbers, 0, i); swap (numbers, i, maxInd); } } void displayArray (int numbers[], int size1) /*Function displayArray*/ { int i; printf("This is the sorted set of numbers: \n"); for (i=0; i< size1; i++) { printf ("%d\t", numbers[i]); } } void getArray (int numbers[], int size1) /*Function getArray*/ { int i; for (i=0; i<size1; i++) { printf ("Enter the values of the %d elements: ", size1); numbers[i]=GetInteger(); } } int indexMax (int numbers[], int low, int high) /*Function indexMax*/ { int i, maxInd; maxInd=high; for (i=low;i<=high;i++) { if (numbers[i]>numbers[maxInd]) { maxInd =i; } } return (maxInd); } void swap (int numbers[], int loc, int loc1) /*Function swap*/ { int temp; temp=numbers[loc]; numbers[loc]=numbers[loc1]; numbers[loc1]=temp; } int binSearch(int val, int numbers[], int size1) /*Function binSearch*/ { int low, high, mid; low=0; high=size1-1; while(low<=high) { mid=(low+high)/2; if(val<numbers[mid]) { high=mid-1; } else if(val>numbers[mid]) { low=mid+1; } else if(val==numbers[mid]) { printf("Your number is in location %d\n", mid+1);break; } else { printf("Your value is not in the array."); } } } 

The above binary search algorithm code that I tried to compile.

+7
source share
11 answers

I can guess the old copy of your program is still running. Windows does not allow you to modify the files that are currently β€œused”, and your linker cannot write a new .exe at the top of the running one. Try to stop / kill your program.

+9
source

I am sure that this is because you did not close the executable instance of the program before trying to recompile it .

Typically, ld.exe returns 1 when it cannot access the required files. Usually this

  • Unable to find associated object file (or Access denied )
  • Cannot find one or more characters for the link
  • Unable to open executable file for writing (or AD)

The program looks completely normal, so the second point should not be hit. In normal cases, it is impossible for ld not be able to open the object file (unless you have a faulty disk and a dirty file system), so the first point is also almost impossible.

Now we move on to the third point. Please note that Windows does not allow writing to a file when used , so the executable instance of your program prevents ld.exe writing a new linked program to it.

So, next time, be sure to close running programs before compiling.

0
source

You can compile your program while another program can run in the background. First, see if another program is starting. Close it, and then try the ro command.

0
source

Using code :: blocks, I solved this error by doing:

workspace properties> build target> build target files

and checking each project file.

0
source

Just try "gcc filename.c -lm" while compiling the program ... it worked for me

0
source

1d returned 1 output status error

First of all you have to create a project by clicking on the new file and then project and give the name of the project, select the language c or c ++ and also select empty. Then your program is under this project ... And then give the name of the program, save it .... Make sure your program is under some kind of project in order to compile and run the program ...

-1
source

This is a simple MAYUS word. check the log.

-1
source

Perhaps you just said that the main {.... I use int main {when I start my main.

-2
source

This answer was written for C ++ developers because I was haunted by a problem like one. Here is the solution:

Instead

 main() { } 

enter

 int main() { } 

therefore, the main function can be performed.

By the way, if you compile the source C / C ++ file without the main function to execute, there will certainly be an error message:

"[Error] Identifier returned 1 status exists"

But sometimes we just don’t need the main function in the file, in this case just ignore the error message.

-2
source

My solution is to try to open another file that you can successfully run that you create on another PC, open this file and run it, after that copy this file and create a new file. Try to run it.

-2
source

it looks like this happens when you have a previous compiled version of your program running

-3
source

Source: https://habr.com/ru/post/949721/


All Articles