delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/12/12/15:16:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Fiendish McTavern" <drulius1nospam AT suddenlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: [new user] compile and link on winXp cmd line versus makefile
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
Message-ID: <_cX7j.6211$3b7.2346@newsfe23.lga>
NNTP-Posting-Host: 75.110.200.158
X-Complaints-To: abuse AT suddenlink DOT net
X-Trace: newsfe23.lga 1197490106 75.110.200.158 (Wed, 12 Dec 2007 13:08:26 MST)
NNTP-Posting-Date: Wed, 12 Dec 2007 13:08:26 MST
Organization: Suddenlink
Date: Wed, 12 Dec 2007 14:06:21 -0600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all,

I can successfully compile and link an application from the command line 
with these two lines: (consider cd already pointing to local dir)

nasm32 -f coff asgn4.asm -o asgn4.o
gcc -o asgn4.exe dvideo.c asgn4.o

But if I try to use a makefile with what I think are lines that have the 
same meaning, the linking doesn't work.  I get undefined reference errors 
for every call in .c main() to functions declared extern in the .h header 
file which are defined as globals in the .asm code file.  (DVIDEO.C also 
defines a global: int text_buffer  = __dpmi_segment_to_descriptor(0xb800) 
and then text_buffer is declared extern in the .asm file.)  Here are the 
contents of the makefile I'm trying:

.phony: all
all: app
app: DVIDEO.C DVIDEO.H asgn4
    gcc -o asgn4.exe DVIDEO.C asgn4.o
asgn4: asgn4.asm
    nasm32 -f coff asgn4.asm -o asgn4.o

I am using DJGPP gcc422b and make3791b.  If I use the -Xlinker --verbose 
option for the gcc call within the makefile, gcc reports that my two .o 
object files are successfully opened for linking (along with all the library 
object files), but somehow the linking fails, and all the error report lines 
begin just after the last .o file opens successfully.

Can anyone offer any assistance?

I have already earned an A+ in the class for which asgn4.exe was an 
assignment.  This question revolves around work I'm doing for a project 
which will allow future students of the same class to use Eclipse with the 
CDT, and assembly plug-ins for developing class projects.  I have already 
eliminated Eclipse from the question presented here, because the errors show 
up even when I call make directly from the command line, "make -f 
makefile.txt -k all".  But the errors don't appear, and an .exe file is 
created, if I run the two calls to nasm32 and gcc directly from the command 
line (or in a .bat script).  My belief at this point is that I haven't set 
some flag or evironment variable within DJGPP (and/or make) properly, but 
I've exhausted all the places I can think to look.

Any help is greatly appreciated.

Jon 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019