Omnet IDE and C source files

46 views
Skip to first unread message

Anna Förster

unread,
Jan 25, 2012, 8:16:51 AM1/25/12
to omn...@googlegroups.com
Hi all,

I have some .c files in the project directory in the omnetpp IDE and I cannot get the IDE to compile them, so it throws linker errors. Any ideas of how to do it without touching directly the Makefile?

Anna
--
Dr. Anna Förster
PostDoctoral Researcher
Networking Laboratory, SUPSI
Via Cantonale, Galleria 2
Manno, Switzerland
Tel. + 41 58 666 6597
http://www.dti.supsi.ch/~afoerste/

Andras Varga

unread,
Jan 25, 2012, 12:15:42 PM1/25/12
to omn...@googlegroups.com
Some ideas:
1) rename *.c to *.cc
2) wrapper .cc files: for i in *.c; do echo "#include \"$i\"" > ${i}c; done
3) put them into a separate directory and hand-craft a makefile for them
4) custom rules in makefrag

Andras

> --
> Sent from the OMNeT++ mailing list. To configure your membership,
> visit http://groups.google.com/group/omnetpp

Anna Förster

unread,
Jan 26, 2012, 4:17:41 AM1/26/12
to omn...@googlegroups.com
HI Andras,

thanks for the ideas. The code by itself and its source files cannot be touched, so I opted for the makefrag idea. However, I am not very successful at it. What I have in my makefrag is the following:

...
all: $(TARGET) flexorall

flexorall: flexor_specifications.o flexor.o callback_manager.o flexor_module.o flexor_packet.o module_manager.o packet_buffer.o blink_module_blue.o callback_module.o flexor_spec_empty.o flexor_spec_blink_blue.o

image_empty.o: $(FLEXOR_DIR)/images/image_empty.c $(FLEXOR_DIR)/images/image_empty.h
$(CC) -c $(FLEXOR_DIR)/images/image_empty.c $(CFLAGS)

...

But this ends up like this in the Makefile (the all target gets overwritten again after my rules):

...
all: $(TARGET) flexorall

flexorall: flexor_specifications.o flexor.o callback_manager.o flexor_module.o flexor_packet.o module_manager.o packet_buffer.o blink_module_blue.o callback_module.o flexor_spec_empty.o flexor_spec_blink_blue.o

image_empty.o: $(FLEXOR_DIR)/images/image_empty.c $(FLEXOR_DIR)/images/image_empty.h
$(CC) -c $(FLEXOR_DIR)/images/image_empty.c $(CFLAGS)

...

# <<<
#------------------------------------------------------------------------------

# Main target
all: $(TARGET)

$(TARGET) : $O/$(TARGET)
$(LN) $O/$(TARGET) .

...

What am I misisng?

Thanks a lot,
Anna

Reply all
Reply to author
Forward
0 new messages