I am using CodeBlocks IDE with Digital Mars compiler, although my program is compiling and there are no errors, when I try to build my program, i get this error and the program isn't running.

OPTLINK (R) for Win32  Release 8.00.5
Copyright (C) Digital Mars 1989-2009  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 3: Cannot Create File Programs\arrays.exe
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

My program is :-

#include<iostream.h>
#include<conio.h>
const int MAX=5;
class array{
    private:
    int arr[MAX];
    public:
    void insert(int,int);
    void display();
};
void array :: insert(int pos, int num)
{
    int i=0;
    for(i=pos-1;i<MAX;i++)
      arr[i+1]=arr[i];
    arr[i]=num;
}
void array :: display()
{
    int i;
    cout<<" ";
    for(i=0;i<MAX;i++)
      cout<<arr[i]<<" ";
}
void main()
{
    array a;
    cout<<"Hello World";
    a.insert(1,3);
    a.insert(2,10);
    a.insert(3,15);
    a.insert(4,25);
    a.insert(5,50);

    a.display();
    getch();
}

Please help.

So, what does the linker documentation say that an Error 3 represents? If there were no compilation time errors, then this is probably a linker error, as your title to the post suggests. You could try installing cygwin, and using their gnu compiler to build this. Gnu compiler tools tend to be more informative as to the errors you encounter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.