Compiler options from within OMNeT++ IDE

461 views
Skip to first unread message

Angelos Vassiliou

unread,
May 29, 2011, 11:16:32 AM5/29/11
to omn...@googlegroups.com
Hi all,

does anybody know how i can supply specific compiler options for when OMNeT++ is compiling a specific C++ file? (a header file that one of the simple module C++ classes uses).

I would like to add the -std=c++0x option. When i compile the particular header file from the console, it compiles just fine, but i cannot seem to find the compiler options configuration from within the OMNeT++ IDE. I am using OMNeT++ Version: 4.1, running on Ubuntu 10.4

Rudolf Hornig

unread,
May 30, 2011, 5:12:31 AM5/30/11
to omn...@googlegroups.com
Hi, I'm not sure why you need this option only for single file. If possible I would recommend to specify this option globally in CFLAGS.

If you really badly need that only a single file will compiled with this, here is a trick:

The OMNET generated makefile uses a pattern rule to compile .cc file to .o. Additionally you can use a "makefrag" file that is automatically inserted in the generated makefile.

The solution is to check the makefile, how the compile rule is written then write a similar rule in your makefrag file (but specify exact filename). That makefrag will be inserted in the generated makefile and your more specific rule will be used during compilation...

Right now the compile rule looks somthing like this:
$O/%.o: %.cc                                                                                                             
          @$(MKPATH) $(dir $@)                                                                                             
          $(CXX) -c $(COPTS) -o $@ $<

and you will need this in your makefrag

$O/myfile.o: myfile.cc                                                                                                             
          @$(MKPATH) $(dir $@)                                                                                             
          $(CXX) -c $(COPTS)  -std=c++0x -o $@ $<

Rudolf

--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omnetpp?hl=en.

Reply all
Reply to author
Forward
0 new messages