Mailing list archive (omnetpp-l at omnetpp.org)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: [Omnetpp-l] how to debug in omnetpp
Damien and All,
Based on your instructions in previous e-mails and some trials and
errors, I could successfully compile INET within VS (* only 2008
express version tested, but I guess it works with other versions as
well *).
Initially I've had difficulties due to automatic processing of all
subdirectories by "makemakefiles"; because VS (by default) adds two
directories, i.e. "Debug" and "Release", the resulting "Makefile.vc"
tries to process these directories as well, which ends up failure.
So, first one needs to modify "makemakefiles" as follows (i.e., adding
"-X Debug -X Release"):
====================================================================
.....
inetbase:
$(MAKEMAKE) $(OPTS) -n -r -X Documentation -X Etc -X Examples
-X Tests -X Experimental -X Obsolete -X tmp -X Debug -X Release
.....
====================================================================
Then here is the setup for VS:
====================================================================
* For "Build Command Line":
if not exist Makefile.vc makemake.cmd
nmake /NOLOGO /S -f Makefile.vc depend
nmake /NOLOGO /S -f Makefile.vc
* For "Rebuild All Command Line":
if not exist Makefile.vc makemake.cmd
nmake /NOLOGO /S -f Makefile.vc depend
nmake /NOLOGO /S -f Makefile.vc clean
nmake /NOLOGO /S -f Makefile.vc
* For "Clear Command Line":
if not exist Makefile.vc makemake.cmd
nmake /NOLOGO /S -f Makefile.vc depend
nmake /NOLOGO /S -f Makefile.vc clean
del Makefile.vc
====================================================================
One can start with the above for his/her own configurations much like
I did with Damien's.
By the way, I think this hasn't been mentioned before; to set up
OMNeT++ (and any other) environment variables only for VS (not on
permanent basis), one can use a batch file like this:
====================================================================
@echo off
echo Setting environment variables for OMNeT++ ...
set BISON_HAIRY=E:\Bin\bison.hairy
set BISON_SIMPLE=E:\Bin\bison.simple
set TCL_LIBRARY=E:\Tools\Tcl\lib\Tcl8.4
set PATH=%PATH%;E:\Tools\omnetpp\bin
call "E:\Bin\set_tools.bat"
REM
REM You can add more environement settings as you wish before
launching the VS!!!
REM
start "" "E:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\VCExpress.exe"
====================================================================
Don't forget to add two double quotation marks ("") before calling VS;
otherwise, you end up with a non-responsive command window together
with the VS.
Damien, again I do appreciate your nice contributions which could save
me a lot of time!
Regards,
Joseph
2008/9/2 Damien Decremer <Damien.Decremer at xxx>:
> Hello Joseph,
>
> I'm afraid I didn't. However, when you look at my makefile.gen.vc, you
> will see it is just a call to "opp_nmakemake" with some switches. Look
> at my previous post: "http://www.omnetpp.org/listarchive/msg11406.php".
> I suppose you just need to change the include folders for the
> compilation with INET, but this really is a long shot since I really
> have no idea.
>
> Good luck,
> Damien
>
>
>
>
>
> Kyeong Soo (Joseph) Kim wrote:
>> Hello Damien,
>>
>> Great thanks for your sharing this valuable information!
>>
>> By the way, I wonder whether you have ever set up a VS project to use
>> with INET framework rather than MOBFW; for instance, one obvious
>> difference would be creating makefiles (i.e., there is no
>> "Makefile.gen.vc" in INET framework).
>>
>> Can you provide any clue in this regard based on your experience?
>>
>> With Regards,
>> Joseph
>>
>>
>> 2008/8/22 Damien Decremer <Damien.Decremer at xxx>:
>>
>>> Oh, that doesn't sound familiar. You do use the mobility framework,
>>> don't you? Otherwise there is no need for the MOBFW variable and you
>>> could basically make a makefile only with:
>>> opp_nmakemake -f -x
>>>
>>> When running in command line, this should be the command you type in
>>> order to make a makefile. Have you set your environment variables
>>> correctly? You can test by opening a command prompt and just type
>>> opp_nmakemake -f -x
>>>
>>> the output should be something like:
>>> C:\Documents and Settings\Administrator>opp_nmakemake -f -x
>>> Creating Makefile.vc in C:/Documents and Settings/Administrator...
>>> Makefile.vc created.
>>> Please type `nmake -f Makefile.vc depend' NOW to add dependencies!
>>>
>>> The -I switch is to add additional include paths. If you don't need it,
>>> there is no need for that switch.
>>> More info on the switches with
>>> opp_nmakemake -h
>>>
>>>
>>> Any results?
>>>
>>>
>>>
>>> wu frank wrote:
>>>
>>>> Thank you very much for your message and your kind help.
>>>>
>>>> I have followed the steps to configure the VS 2005.
>>>>
>>>> When I start debuging the project, there is an error in my
>>>> Makefile.gen.vc file
>>>>
>>>> in this line
>>>> -------------------------------------------------------------------
>>>> opp_nmakemake -f -x -I$(MOBFW)\core\include -I$(MOBFW)\contrib\include
>>>> $(MOBFW)\core\lib $(MOBFW)\contrib\lib
>>>> -------------------------------------------------------------------
>>>>
>>>> the error message is
>>>> ---------------------------------------
>>>> fatal error U1034: syntax error : separator missing
>>>> ---------------------------------------
>>>>
>>>> Could you help me on that?
>>>>
>>>> Thanks,
>>>> Frank
>>>>
>>>> --- On *Thu, 21/8/08, Damien Decremer
>>>> /<Damien.Decremer at xxx>/* wrote:
>>>>
>>>> From: Damien Decremer <Damien.Decremer at xxx>
>>>> Subject: Re: [Omnetpp-l] how to debug in omnetpp
>>>> To: "OMNeT++ Discussion List" <omnetpp-l at xxx>
>>>> Date: Thursday, 21 August, 2008, 11:21 AM
>>>>
>>>> Sure it can. When you create a project in VS, you need to choose a
>>>> "Makefile Project", which is situated in "Visual
>>>> C++/General".
>>>> A wizard will pop up in which you can define the build command line etc.
>>>> I usually just click finish here. I prefer to set the settings
>>>> afterwards where there are more options.
>>>> Now you can right click on your project in the "solution explorer"
>>>> and
>>>> choose "properties".
>>>> Navigate to "NMake" in the left pane and there are the fields you had
>>>> in
>>>> the wizard again. Only this time, if you click inside it, a little icon
>>>> with three dots will appear at the right of the field. Clicking on it
>>>> gives you the possibility to add a multi-line command.
>>>>
>>>> For building I use the following:
>>>>
>>>> if not exist Makefile.gen.vc copy
>>>> "c:\omnetpp\Makefile.gen.vc" .\
>>>> if exist Makefile.vc del Makefile.vc
>>>> nmake /NOLOGO /S -f Makefile.gen.vc && nmake /NOLOGO /S -f Makefile.vc
>>>> depend
>>>> nmake /NOLOGO /S -f Makefile.vc
>>>>
>>>> Of course, you need a valid Makefile.gen.vc in your omnetpp folder.
>>>>
>>>> The rest of the fields are as follows:
>>>>
>>>> Rebuild All Command Line:
>>>> if not exist Makefile.gen.vc copy
>>>> "c:\omnetpp\Makefile.gen.vc" .\
>>>> if exist Makefile.vc del Makefile.vc
>>>> nmake /NOLOGO /S -f Makefile.gen.vc && nmake /NOLOGO /S -f Makefile.vc
>>>> depend
>>>> nmake /NOLOGO /S -f Makefile.vc clean
>>>> nmake /NOLOGO /S -f Makefile.vc
>>>>
>>>> Clean Command Line:
>>>> if not exist Makefile.gen.vc copy
>>>> "c:\omnetpp\Makefile.gen.vc" .\
>>>> if exist Makefile.vc del Makefile.vc
>>>> nmake /NOLOGO /S -f Makefile.gen.vc && nmake /NOLOGO /S -f Makefile.vc
>>>> depend
>>>> nmake /NOLOGO /S -f Makefile.vc clean
>>>> del Makefile.gen.vc
>>>> del Makefile.vc
>>>>
>>>> To enable IntelliSense for makefile projects in the IDE, change the
>>>> "Common Language Runtime Support" to "Common Language Runtime
>>>> Support
>>>> (/clr)"
>>>> Change the "Include Search Path" to
>>>> "C:\omnetpp\mobility-fw\contrib\include";"C:\omnetpp\mobility-fw\core\include";C:\omnetpp\include"
>>>>
>>>> Click Ok and Save all files in of the project. It is possible that you
>>>> need to close and reopen your VS Project.
>>>>
>>>>
>>>>
>>>>
>>>> My Makefile.gen.vc looks like this because I use the Mobility framework
>>>> as well:
>>>>
>>>> # Makefile for own simulations on windows
>>>>
>>>> MOBFW = c:\omnetpp\mobility-fw
>>>>
>>>> all:
>>>> opp_nmakemake -f -x -I$(MOBFW)\core\include
>>>> -I$(MOBFW)\contrib\include $(MOBFW)\core\lib
>>>> $(MOBFW)\contrib\lib
>>>>
>>>> # DO NOT DELETE THIS LINE -- make depend depends on it.
>>>>
>>>>
>>>>
>>>> And don't forget your environment variables must be set correctly. If
>>>> you installed OMNeT++ with the binary it should be ok, but if you did it
>>>> from source, make sure the following are set:
>>>> OMNETPP_BITMAP_PATH=.\bitmaps;c:\omnetpp\bitmaps;c:\omnetpp\mobility-fw\bitmaps
>>>> Path=c:\omnetpp\lib\doxygen\bin;c:\omnetpp;c:\omnetpp\bin
>>>> TCL_LIBRARY=c:\omnetpp\lib\tcl8.4
>>>>
>>>>
>>>> You might want to check the paths in the following files as well. If
>>>> they are not set correctly, it won't work.
>>>> 'c:\omnetpp\configuser.vc'
>>>> 'c:\omnetpp\Makefile.gen.vc'
>>>> 'c:\omnetpp\mobility-fw\mkmk.cmd' if you use the Mobility
>>>> Framework
>>>>
>>>>
>>>> This should do the trick. So now if you want to place breakpoints in the
>>>> omnet code, just open the source file where the code is located inside
>>>> Visual Studio. Place a breakpoint like you do with your own code and
>>>> that's it. Nothing is more easy.
>>>> Another nice trick: use the
>>>> 'breakpoint("hello, this is an OMNeT++ breakpoint");'
>>>> command in your code. It works on a different level than the breakpoints
>>>> in Visual Studio and could come in handy!
>>>>
>>>>
>>>> Cheers,
>>>> Damien
>>>>
>>>> wu frank wrote:
>>>> > Can the program written in omnetpp run in MS Visual Studio?
>>>> > When I run the my program in MS Visual Studio, MS Visual Studio can
>>>> > not find some include files, although I have add these files to the
>>>> > system environment variables.
>>>> >
>>>> > Another question, how can i set the breakpoints in omnetpp?
>>>> >
>>>> > Thanks,
>>>> > Frank
>>>> >
>>>> > --- On *Wed, 20/8/08, Damien Decremer
>>>> > /<Damien.Decremer at xxx>/* wrote:
>>>> >
>>>> > From: Damien Decremer <Damien.Decremer at xxx>
>>>> > Subject: Re: [Omnetpp-l] how to debug in omnetpp
>>>> > To:
>>>> > Cc: omnetpp-l at xxx
>>>> > Date: Wednesday, 20 August, 2008, 11:54 AM
>>>> >
>>>> > I use an external programming environment such as Microsoft Visual
>>>> > Studio or Eclipse. They have powerful debuggers and since OMNeT++ is
>>>> > open source, you can put breakpoints anywhere :-).
>>>> >
>>>> > Andreas Köpke wrote:
>>>> > > Since many programmers seem to have problems debugging in Omnet
>>>> and MF,
>>>> > > I recommend the following book:
>>>> > >
>>>> > > Steve McConnell: Code complete. 2nd edition. Microsoft Press;
>>>> 2004.
>>>> > >
>>>> > > More can be said on this topic, but it is important to master the
>>>> basics
>>>> > > first.
>>>> > >
>>>> > > You can also have a look at this book:
>>>> > >
>>>> > > http://www.whyprogramsfail.com/
>>>> > >
>>>> > > Best, Andreas
>>>> > >
>>>> > > Am Dienstag, den 19.08.2008, 17:05 +0200 schrieb Andreas Köpke:
>>>> > >
>>>> > >> Yes, I do.
>>>> > >>
>>>> > >> Am Dienstag, den 19.08.2008, 12:12 +0000 schrieb wu frank:
>>>> > >>
>>>> > >>> Dear All,
>>>> > >>>
>>>> > >>> Does anyone know how to debug in omnetpp?
>>>> > >>>
>>>> > >>> Thanks,
>>>> > >>> Frank
>>>> > >>>
>>>> > >>> Send instant messages to your online friends
>>>> > >>> http://uk.messenger.yahoo.com
>>>> > >>> _______________________________________________
>>>> > >>> Omnetpp-l mailing list
>>>> > >>> Omnetpp-l at xxx
>>>> > >>> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>> > >>>
>>>> > >> _______________________________________________
>>>> > >> Omnetpp-l mailing list
>>>> > >> Omnetpp-l at xxx
>>>> > >> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>> > >>
>>>> > >
>>>> > > _______________________________________________
>>>> > > Omnetpp-l mailing list
>>>> > > Omnetpp-l at xxx
>>>> > > http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>> > >
>>>> >
>>>> > _______________________________________________
>>>> > Omnetpp-l mailing list
>>>> > Omnetpp-l at xxx
>>>> > http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>> >
>>>> >
>>>> >
>>>> > Send instant messages to your online friends
>>>> > http://uk.messenger.yahoo.com
>>>>
>>>> _______________________________________________
>>>> Omnetpp-l mailing list
>>>> Omnetpp-l at xxx
>>>> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>>
>>>>
>>>>
>>>> Send instant messages to your online friends
>>>> http://uk.messenger.yahoo.com
>>>>
>>> _______________________________________________
>>> Omnetpp-l mailing list
>>> Omnetpp-l at xxx
>>> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>>
>>>
>> _______________________________________________
>> Omnetpp-l mailing list
>> Omnetpp-l at xxx
>> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus signature database 3407 (20080902) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
>
> _______________________________________________
> Omnetpp-l mailing list
> Omnetpp-l at xxx
> http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
>
_______________________________________________
Omnetpp-l mailing list
Omnetpp-l at xxx
http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
Home |
Main Index |
Thread Index