Code Block: Error

I am using Code Blocks version 12.11, when i run any code in code blocks IDE it shows the following message, so please help what is wrong my code blocks


-------------- Build: Debug in ProjectOne (compiler: GNU GCC Compiler)---------------

ar.exe -o bin\Debug\ProjectOne.exe obj\Debug\main.o
ar.exe: no operation specified
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
it says you have no errors?
but does not display anything, here my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

#include <stdio.h>
#define N 40
void sum(int*p, int n, int d[])
{
  int i;
  *p = 0;
  for(i = 0; i < n; ++i)
     *p = *p + d[i];
}
int main()
{
   int i;
   int accum = 0;
   int data[N];
   for(i = 0; i < N; ++i)

      data[i] = i;

    sum(&accum, N, data);
    printf("sum is %d\n", accum);
	return 0;
}
Last edited on
it says "sum is 700" on my machine.

can you stick a breakpoint on line 22 and look at your console/output window?
Possibly, your program exits too fast.
In this case you should pause your program when your program ends. To do this you'll only need to include <conio.h> then add getch(); at the end of your function main(), before the code return 0;.

Edit :
@mutexe - I see it says "sum is 780", not 700 as you mentioned above
Last edited on
Hi there,

i think you should check your settings.
I do use CodeBlocks as well, and i think i had simillar issues. However, this is my build log....

1
2
3
4
5
6
7

Compiling: main.cpp
Linking console executable: bin/Debug/tester
Output size is 8,31 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings


What you get looks like a linker error. Maybe try compiling from comandline.

By the way, you use windows ?
I have no experience with that so far ... "ar.exe" is said to create static libraries ... maybe that is the point ?
wtf?
no errors and no warnings.
In other words:
NO ERRORS.
I'm with fluppe. This line means something did not go right with the build process.

Process terminated with status 1 (0 minutes, 0 seconds)


... maybe it would make sense to look what the "physical" output of the build-process is, i.e. if there are object files in the respective folders etc. and exe (i bet not) or anything can be found.
Topic archived. No new replies allowed.