简体   繁体   English

将C代码从Visual Studio迁移到Linux

[英]moving a C code from visual studio to linux

hello i am trying to sort a linked list when i sort it it works on visual studio but when i move it to linux the linked list does not get sorted for some reason. 你好,我正在尝试对链表进行排序,当它在Visual Studio上工作时,但是当我将其移至linux时,由于某种原因,链表未进行排序。 my sorts gets a pointer to a pointer of the list and this is my sort code: i call the function like this: SortQueue(&pprocessQueue, ProcessPrIdCompare); 我的排序获取指向列表指针的指针,这是我的排序代码:我这样调用函数: SortQueue(&pprocessQueue, ProcessPrIdCompare); and here is my function the function uses EnqueueInOrder which puts every link in his place. 这是我的函数,该函数使用EnqueueInOrder将每个链接放在他的位置。

 void SortQueue(Queue **pqueue, CompareFunction CompareElements)
 {
   Queue *ptemp = CreateQueue( (*pqueue)->CopyElement, 
                               (*pqueue)->FreeElement,
                               CompareElements,
                               (*pqueue)->PrintElement );

   (*pqueue)->CompareElements = CompareElements;

   while (!(IsEmpty(*pqueue) == SUCCESS))
     EnqueueInOrder(ptemp, DequeueLink(*pqueue));

   while (!(IsEmpty(ptemp) == SUCCESS))
    EnqueueInOrder(*pqueue, DequeueLink(ptemp));

   FreeQueue(ptemp);
}

1 more thing i am using gcc to compile. 我正在使用gcc进行编译的1件事。

I don't see the problem with your code. 我看不到您的代码有问题。 It'll probably be wise to check the code that reposes outside of the code you've shown us. 检查位于您展示给我们的代码之外的代码可能是明智的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM