X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=OFN/GmC4zrvtbYxT
	9sD6EMc9m9ulKLlMfvgAzwgt5ub/rf+o1ZFo9lXkhRzldHMJ6jXKbpYDa2E8lZgL
	fG4iLOWKgpUSUv9FvOHgefYgQHYUtRJgvXLfPT2ASykndLbUYPpElkiQT0n7bDID
	uYJK1AImPMk96W/K93snhq0bJJU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=gCPjzSsL0fwATXWWvKNSem
	LLytw=; b=WHiqaU15rpenZWCWlRtOK0Ry68ClWhiydu12mrZsLhTmINNOaKVZel
	Wvat4XoxlYXFaP3rXcLXqXDPDB8b7bbBY9O6u+8a+S3yv4+jQIr2X2UwjqAZ1Eqq
	jSgLbU5dO++O6ELyUQzqQrsefpzt4QJdSuVmJEwDNJdXTaDtNlyLw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*u:6.1, H*UA:6.1, H*UA:Firefox, HContent-Transfer-Encoding:8bit
X-HELO: m0.truegem.net
Subject: Re: make failing in custom code
To: cygwin@cygwin.com
References: <CAPhqJV0s8HHSFDbiSvCMdDo=mwR33nee91SgNB=+7kJpftWH0Q@mail.gmail.com>
From: Mark Geisert <mark@maxrnd.com>
Message-ID: <c687b7fa-303b-7703-859d-c97938d7ff48@maxrnd.com>
Date: Thu, 27 Sep 2018 09:49:18 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46
MIME-Version: 1.0
In-Reply-To: <CAPhqJV0s8HHSFDbiSvCMdDo=mwR33nee91SgNB=+7kJpftWH0Q@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Tapas Mishra wrote:
> Hi,
> I am trying to do a project  when I do a make on project code
> in cygwin environment I get following error
>
> gcc -Wall -g -c main.c -o main.o
> main.c: In function ‘main’:
> main.c:50:8: warning: unused variable ‘physmem’ [-Wunused-variable]
>   char *physmem = page_table_get_physmem(pt);
>         ^~~~~~~
> gcc -Wall -g -c page_table.c -o page_table.o
> page_table.c: In function ‘page_table_set_entry’:
> page_table.c:125:2: warning: implicit declaration of function
> ‘remap_file_pages’ [-Wimplicit-function-declaration]
>   remap_file_pages(pt->virtmem+page*PAGE_SIZE,PAGE_SIZE,0,frame,0);
>   ^~~~~~~~~~~~~~~~
> gcc -Wall -g -c disk.c -o disk.o
> gcc -Wall -g -c program.c -o program.o
> gcc main.o page_table.o disk.o program.o -o virtmem
> page_table.o: In function `page_table_set_entry':
> /home/DEEL/cs602/try1/page_table.c:125: undefined reference to
> `remap_file_pages'
> /home/DEEL/cs602/try1/page_table.c:125:(.text+0x491): relocation
> truncated to fit: R_X86_64_PC32 against undefined symbol
> `remap_file_pages'
> collect2: error: ld returned 1 exit status
> make: *** [makefile:2: virtmem] Error 1
>
> I compiled the same code on a linux instance hosted on amazon cloud
> and it compiled successfully. So this brought me to a conclusion some
> files are missing in cygwin and hence I reached here.

I glanced at your pastebin files briefly.  These warnings and errors appear to 
be garden variety coding issues.  Nothing Cygwin-specific that I can see.

The first warning is that you've defined physmem but aren't using that 
definition anywhere in the same function.  The second warning tells that you 
haven't defined remap_file_pages() at any point before it's used in that source 
file.  It needs to be defined before use in that file, or in a header file 
#included before use.  And the error message is messily saying 
remap_file_pages() wasn't defined in any of the object files you're linking.

Dunno how this could work as-is anywhere :-).  Minor tweaks should fix it.

..mark


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

