You are not logged in.

  • Login

Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, November 9th 2006, 12:54pm

Problem mit Makefile

Hi,

ich wollte mich ein bisschen in die Makefiles einarbeiten und habe jetzt ein problem.
Mit dem Makefile wird zwar eine .exe datei erzeugt aber wenn ich diese aufruf passiert nichts. (es kommt keine ausgabe)

In der C Datei steht nur ein einfaches printf und wenn ich es mit hilfe von

gcc -o test.exe main.c

funktioniert alles richtig.

C Datei:

C Quellcode

1
2
3
4
5
6
7
8
#include <stdio.h>
 
int main(){
 
	printf("test\n");
 
	return 0;
}


Makefile:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.PHONY: all clean 

CC=gcc
CFLAGS=-Wall -g
LDFLAGS=-mwindows
RM=rm

EXE=test.exe
SOURCE=main.c
OBJECT=$(SOURECE:.c=.o) # replaces the .c from SOURCE with .o




%.o: %.c # combined w/ next line will compile recently changed .c files
	$(CC) $(CFLAGS) -o $@ -c $<

all: $(EXE)      # all is dependent on $(EXE) to be complete

$(EXE): $(OBJ)   # $(EXE) is dependent on all of the files in $(OBJ) to exist
	$(CC) $(OBJ) $(LDFLAGS) -o $@

clean:
	del ${EXE} ${OBJ}

Ich programmier unter Windows mit GCC.

Gruß heinz

2

Thursday, November 9th 2006, 4:41pm

hab mir selbst geholfen...

dieser flag war falsch: LDFLAGS=-mwindows

sobald man -mwindos entfernt läuft es einwandfrei...

3

Thursday, November 9th 2006, 8:43pm

Hängt vom verwendeten Linker ab - war das mal für Mingw gedacht?

Social bookmarks