Mail Archives: djgpp/2000/10/17/17:58:43
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 -