delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "Wiktor S." <wswiktorSP AT Mpoczta DOT fm> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | GCC 5.1.0 problem with <dos.h> |
Date: | Tue, 28 Apr 2015 01:22:58 +0200 |
Organization: | INTERIA.PL S.A. |
Lines: | 51 |
Message-ID: | <mhmgck$ims$1@usenet.news.interia.pl> |
NNTP-Posting-Host: | user-46-112-109-139.play-internet.pl |
X-Trace: | usenet.news.interia.pl 1430176980 19164 46.112.109.139 (27 Apr 2015 23:23:00 GMT) |
X-Complaints-To: | usenet AT firma DOT interia DOT pl |
NNTP-Posting-Date: | Mon, 27 Apr 2015 23:23:00 +0000 (UTC) |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2900.5931 |
X-RFC2646: | Format=Flowed; Original |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2900.6157 |
Bytes: | 2221 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hello. I found this problem when trying to compile the game of Quake, which compiles with no problems with GCC 4.9.2 Simply #include'ing <dos.h> in multiple .c files causes the following errors: C:\wiktor\myprogs\djtest>gcc -c a.c C:\wiktor\myprogs\djtest>gcc -c b.c C:\wiktor\myprogs\djtest>gcc a.o b.o -o a.exe b.o:b.c:(.text+0x0): multiple definition of `inportb' a.o:a.c:(.text+0x0): first defined here b.o:b.c:(.text+0x1b): multiple definition of `inportw' a.o:a.c:(.text+0x1b): first defined here b.o:b.c:(.text+0x39): multiple definition of `inportl' a.o:a.c:(.text+0x39): first defined here b.o:b.c:(.text+0x54): multiple definition of `outportb' a.o:a.c:(.text+0x54): first defined here b.o:b.c:(.text+0x71): multiple definition of `outportw' a.o:a.c:(.text+0x71): first defined here b.o:b.c:(.text+0x90): multiple definition of `outportl' a.o:a.c:(.text+0x90): first defined here collect2.exe: error: ld returned 1 exit status The workaround is to use a linker option LDFLAGS=-Wl,--allow-multiple-definition Example source: ======== a.c ======== #include <dos.h> int main() { } ======== b.c ======== #include <dos.h> ===================== -- Wiktor Sywula
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |