delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/17/17:58:43

Message-ID: <001201c03885$aa33c820$0500a8c0@brk>
From: "Johan Henriksson" <jhe AT realsoftware DOT cjb DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: Makefile for C++
Date: Wed, 18 Oct 2000 00:00:25 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

from: Johan Henriksson, leadprogrammer @ www.realsoftware.cjb.net
"It is not the length of life that counts but what you make out of it" - me
----------------------------------------------------------------------------
-----------------------------
>Hi,
>I have a C++ which I want to compile using a makefile.
>I have the following program:
>#include <iostream>
>
>int main() // Cria menu e recebe a escolha do utilizador
>{
> int option;
>
> // As próximas linhas (7) imprimem o menu no ecrãn
>
> cout << "\nContas bancarias"
>   << "\n----------------"
>   << "\n"
>   << "\n\t1) Criar Conta a Ordem"
>   << "\n\t2) Sair"
>   << "\n"
>   << "\n\t\t-- Qual a sua opcao? ";
>
> //A proxima linha recebe input do utilizador
>
> cin >> option;
>
> cout << "\nOpcao foi: " << option;
>
> return 1;
>}
>
>And the following makefile:
>
>OBJECTS = banco.o
>TARGET = banco.exe
>SOURCES = banco.cpp
>
>banco.exe: $(OBJECT)
> gcc -g -o $(TARGET) $(OBJECT) -lstdcxx
>
>banco.o: $(SOURCES)
> gcc -g -c -O $(SOURCES)
>
>clear:
> del *.o
> del *.exe
>
>Why is this makefile not working? (since the program is correct and if I
>compile it 'by hand' It works)


It should have given an error. Feel free to include it next time...
Oh well; I see two bad things. the gcc and del lines must be
prefixed by a TAB. A REAL tab. Next, don't use del.
Use rm -f *.o (Unix compatible)
Checking again; Another error. You want OBJECT; But it is defined as
OBJECTS.
CYA

- Raw text -


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