2 Replies - 1043 Views - Last Post: 17 January 2012 - 03:27 PM Rate Topic: -----

Topic Sponsor:

#1 shad0wk1  Icon User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 127
  • Joined: 01-October 10

Pascal - Error while linking

Posted 31 December 2011 - 04:40 AM

Peace. I was doing my assignment in programming paradigm subject. But for some unknown error I can't compile this program. I pretty sure there's no problem as far as I can see. Why it gives out the "error while linking" error?

Coding:
cube.pas
{Assignment 2 Csc305 Question 1 (i)
write function that is called CUBE}
program cubeprogram;
uses Crt;
function CUBE(x : integer) : integer;
   begin
     CUBE:= x*x*x;
   end;

var
   number, answer : integer;
begin
   writeln('Enter number to be cubed: ');
   readln(number);
   answer := CUBE(number);
   writeln('The cube of ',number, '  is ', answer);
   while not keypressed do{Wait for a key to be pressed}
end.


Error:
 - ink.res: file format not recognized; treating as linker script
 - ink.res:1: parse error
19 / 1 cube.pas    Error: Error while linking



Is This A Good Question/Topic? 0
  • +

Replies To: Pascal - Error while linking

#2 111027  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 113
  • Joined: 26-December 11

Re: Pascal - Error while linking

Posted 03 January 2012 - 02:07 PM

What compiler are you using? The code seems fine, though in some compilers, the CRT library causes problems of that type.
Was This Post Helpful? 0
  • +
  • -

#3 shad0wk1  Icon User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 127
  • Joined: 01-October 10

Re: Pascal - Error while linking

Posted 17 January 2012 - 03:27 PM

Sorry for late reply. I was using Dev-Pascal. I think I found the problem. The file path must not have symbols or space. I changed the folder name and it finally work. I am not sure why.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1