MESSAGE
DATE | 2015-01-31 |
FROM | Ruben Safir
|
SUBJECT | Re: [LIU Comp Sci] Linked List Homework
|
From owner-learn-outgoing-at-mrbrklyn.com Sat Jan 31 20:22:33 2015 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix) id BC715161186; Sat, 31 Jan 2015 20:22:33 -0500 (EST) Delivered-To: learn-outgoing-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 28) id ABC97161191; Sat, 31 Jan 2015 20:22:33 -0500 (EST) Delivered-To: learn-at-mrbrklyn.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id 1B8E7161186 for ; Sat, 31 Jan 2015 20:22:33 -0500 (EST) Received: from [10.0.0.19] (unknown [96.57.23.82]) by mailbackend.panix.com (Postfix) with ESMTPSA id C5D2813CE6 for ; Sat, 31 Jan 2015 20:22:32 -0500 (EST) Message-ID: <54CD7FD7.7040308-at-panix.com> Date: Sat, 31 Jan 2015 20:22:31 -0500 From: Ruben Safir User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: learn-at-mrbrklyn.com Subject: Re: [LIU Comp Sci] Linked List Homework References: <54CD7C0E.5020808-at-panix.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: owner-learn-at-mrbrklyn.com Precedence: bulk Reply-To: learn-at-mrbrklyn.com
On 01/31/2015 08:08 PM, Maneesh Kongara wrote: > I wasn't able to build and run the header file for assignment 2. Did it > work for anyone out there?
That codeblock thing I have no idea about but LOOK at the makefile I posted.
The problem is you guys have no clue how the header files work or are compiled into code, or how one creates shared code via object files, no do you likely know what an object file is.
And Codeblock makes you even more stupid. You don't need an IDE, your operating system, that is if you are using a unix variant, is a big giant IDE.
A header file is generally definitions which create symbols that the compiler can identify and put aside room for in do. Then the headers usually have also a shared library (so) or a dynamic linked library, or in simple cases just an object file, that had to be findable by the compile that allows it to fill in the definitions that are defined in the header file.
That is the big #include
Most professional coding involves making OBJECT and shared library files, because those reusable objects are where the money is AT ... to sell API's and programmable objects for projects that others create using your libraries.
In order to link the libraries you have to tell the compiler to go find them. There are a lot of tools to help this along, like make and make.deps and autoconf
Ditch the codeblocks thing and use EMACS or GVIM. Actually learn GVIM and learn the vi editor. You are going to use it for the rest of your life, so take the time to learn it now.
http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html
The fundemental insight of vi usage is that the methods of using vi is included in everything else, like grep, ed, sed, perl, awk, python, ruby, and all the c variants...not to mention korn and bash (and oracles stupid sqlplus crap).
Ruben > Thanks, > Maneesh. > On Jan 31, 2015 8:06 PM, "Ruben Safir" wrote: > >> For the Algorithms class: >> >> For what it is worth, there are a lot of errors inside of the code base >> for the linked list homework, which might make it very hard to actually >> do. The List Structure is NOT dependable as it is written and the Add >> Node after thingie is flatout written wrong. >> >> You end up with a head node with a value of zero that is a dummy node... >> or a stupid node actually because it is not only not needed, but it >> doesn't belong and it generates errors. >> >> My example for collaboration purposes is at >> >> http://www.nylxs.com/docs/grad_school/algorithms/Hwk2/ >> >> specifically examine this >> >> 28 // InsertAfterNode: Create a new node containing val, and link it >> after np. >> 29 // This design is BROKEN. Nodes should never be handled directly but >> handled by the >> 30 // List structure which points to a specific node at all times. >> 31 // ALL List operations should happen through List >> 32 >> 33 void InsertAfterNode(List& L, int val, node *np) >> 34 { >> 35 //this is broken - fix head >> 36 if(L.iter_pos == 0){ >> 37 L.head = np; >> 38 L.head->data = val; >> 39 L.head->next = 0; >> 40 L.tail = L.head; >> 41 L.iter_pos = L.head; //initialize the list location >> 42 return; >> 43 } >> 44 >> 45 node *np2 = new node; >> 46 np2->data = val; >> 47 np2->next = np->next; >> 48 np->next = np2; >> 49 >> 50 if (np2->next == 0) L.tail = np2; >> 51 } >> 52 >> >> >> >>
|
|