Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > undefined reference to `link'

Reply
Thread Tools

undefined reference to `link'

 
 
Jinsong Zhao
Guest
Posts: n/a
 
      11-04-2011
On 2011-11-4 12:32, Geoff wrote:
> On Fri, 04 Nov 2011 08:19:27 +0800, Jinsong Zhao<>
> wrote:
>
>> On 2011-11-4 5:52, Geoff wrote:
>>> On Wed, 02 Nov 2011 00:01:58 +0800, Jinsong Zhao<>
>>> wrote:
>>>
>>>> Is it possible to compile the code on Windows? If yes, how to change the
>>>> code?
>>>
>>> Yes.
>>>
>>> Delete this line (line 5):
>>> # include<unistd.h>
>>> It's for POSIX and it's not needed for Windows and you won't need the
>>> link and unlink POSIXisms below.
>>>
>>> Instead of (line 563):
>>>
>>> if ( unlink(file_out_name),link(file_temp_name, file_out_name) == -1
>>> ||
>>> unlink(file_temp_name) == -1)
>>> {
>>>
>>> write:
>>>
>>> if ( rename(file_temp_name, file_out_name) == -1 )
>>> {
>>>
>>> Instead of (line 606):
>>>
>>> if ( unlink ( file_temp_name ) == -1)
>>> {
>>>
>>> write:
>>>
>>> if ( remove ( file_temp_name ) == -1)
>>> {
>>>

>>
>> Thank you very much. it now could be compiled without any error.
>>
>> However, it does not work as expected. It gave the following error message:
>>
>> E:\f77split>a f77split_prb.f
>> Splitting f77split_prb.f.
>>
>> F77SPLIT: Error!
>> Cannot move "fsplit.XXXXX" to "alpha.f".
>>
>> Regards,
>> Jinsong

>
> Amend line 563 to read:
> if ( remove(file_out_name), rename(file_temp_name, file_out_name)
> == -1 )


Sorry for the previous incomplete post...

Thnaks! I have tried this way, the same error message appears.

Regards,
Jinsong

 
Reply With Quote
 
 
 
 
Geoff
Guest
Posts: n/a
 
      11-04-2011
On Fri, 04 Nov 2011 13:28:29 +0800, Jinsong Zhao <>
wrote:

>On 2011-11-4 12:32, Geoff wrote:
>> On Fri, 04 Nov 2011 08:19:27 +0800, Jinsong Zhao<>
>> wrote:
>>
>>> On 2011-11-4 5:52, Geoff wrote:
>>>> On Wed, 02 Nov 2011 00:01:58 +0800, Jinsong Zhao<>
>>>> wrote:
>>>>
>>>>> Is it possible to compile the code on Windows? If yes, how to change the
>>>>> code?
>>>>
>>>> Yes.
>>>>
>>>> Delete this line (line 5):
>>>> # include<unistd.h>
>>>> It's for POSIX and it's not needed for Windows and you won't need the
>>>> link and unlink POSIXisms below.
>>>>
>>>> Instead of (line 563):
>>>>
>>>> if ( unlink(file_out_name),link(file_temp_name, file_out_name) == -1
>>>> ||
>>>> unlink(file_temp_name) == -1)
>>>> {
>>>>
>>>> write:
>>>>
>>>> if ( rename(file_temp_name, file_out_name) == -1 )
>>>> {
>>>>
>>>> Instead of (line 606):
>>>>
>>>> if ( unlink ( file_temp_name ) == -1)
>>>> {
>>>>
>>>> write:
>>>>
>>>> if ( remove ( file_temp_name ) == -1)
>>>> {
>>>>
>>>
>>> Thank you very much. it now could be compiled without any error.
>>>
>>> However, it does not work as expected. It gave the following error message:
>>>
>>> E:\f77split>a f77split_prb.f
>>> Splitting f77split_prb.f.
>>>
>>> F77SPLIT: Error!
>>> Cannot move "fsplit.XXXXX" to "alpha.f".
>>>
>>> Regards,
>>> Jinsong

>>
>> Amend line 563 to read:
>> if ( remove(file_out_name), rename(file_temp_name, file_out_name)
>> == -1 )

>
>Sorry for the previous incomplete post...
>
>Thnaks! I have tried this way, the same error message appears.
>
>Regards,
>Jinsong


I see it works perfectly in a *nix environment but fails in Windows.

Windows won't allow you to rename an open file. You will have to
change the order of events in the split_file function to write the
contents and close file_temp before the rename. Sorry not to have seen
this earlier.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof x == 'undefined' or x == undefined? -Lost Javascript 13 01-31-2007 12:04 AM
undefined vs. undefined (was: new Array() vs []) VK Javascript 45 09-12-2006 05:26 PM
'Undefined' Client-Side Object Reference Felipe ASP .Net 3 07-16-2004 04:01 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM
Error: 'undefined reference' in g++ but gcc succeeded Lu C++ 1 07-10-2003 12:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57