Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

ns3.43 configure and build problem

86 views
Skip to first unread message

陈家旺

unread,
Dec 4, 2024, 3:52:30 AM12/4/24
to ns-3-users
1733302069557.pngHello everyone!
As a newbie to ns, I've recently encountered some problems with the configuration and build of ns3, and was hoping you could help answer them.
First, my configuration is VMware 17pro, unbuntu24.04.1 and ns3.43.
When I follow the steps in the official ns3 documentation tutorial, I get the output shown below, which is missing “-- Looking for C++ include inttypes.h”
-- Looking for C++ include inttypes.h - found it!
-- Looking for C++ include stat.h
-- Looking for C++ include stat.h - not found
-- looking for C++ include dirent.h
-- looking for C++ include dirent.h - found
-- looking for C++ include stdlib.h
-- looking for C++ include stdlib.h - found
-- looking for C++ include signal.h
-- looking for C++ include signal.h - found
-- Looking for C++ include netpacket/packet.h
-- find C++ include netpacket/packet.h - found
...
-- Find C++ include boost/units/quantity.hpp
-- Find C++ include boost/units/quantity.hpp - Found
-- Find C++ include boost/units/systems/si.hpp
-- looking for C++ include boost/units/systems/si.hpp - found” and so on,  compared to the example in the documentation.
And regarding modules such as BRITE, click and openflow, the latter appears as “OFF (missing headers: ‘simclick.h’ and missing libraries: ‘nsclick click’)”. “nsclick click“)” instead of “OFF (missing dependency)”. What is the reason for the above problem? What should be done to solve it?
Also, I have tried the build operation irrespective of the above issue and also tried to run the first.cc file in the terminal and it also outputs the normal result, but when I run the first.cc using vscode, the header file does not exist as shown in the picture. I did some efforts like changing the includepath variable in the c_cpp_properties.json file, but still it doesn't work.
Finally, the above problem has been bothering me for almost a week, all the methods have been tried, I hope all my friends can help me, thank you! ......
1733301388795.jpg1733302069557.pnga22d15fe9137ecd0d4ba6f0dc746754.png

Tommaso Pecorella

unread,
Dec 4, 2024, 4:16:54 PM12/4/24
to ns-3-users
Hi,

we periodically improve the scripts, so you might find slight differences between the manual and the real output. In the case of the "OFF (missing headers: ‘simclick.h’ and missing libraries: ‘nsclick click’)", it has been modified to help in finding out what dependency is missing.

About the missing modules, like BRITE, click, and openflow, it's pretty common to have them not built. If you don't specifically need them, don't worry.

Last but not least, VSCode sometimes fails to find the include path. It's annoying and it might lead to a lot of red wiggles, but even this is just a nuisance and it's harmless.
One (possible) way to fix this is to not use the "ns3" script and install the cmake extensions in VSCode. They should allow you to have the project configured and compiled from within VSCode. The downside is that you'll have to use VSCode to launch scripts, which might or might not be a further nuisance. However, I have to confess that I haven't tried it myself, so I'm not an expert.

You can also try to use this in the .vscode/c_cpp_properties.json file:
            "includePath": [
                "${workspaceFolder}/build/include/",
                "${workspaceFolder}/src/**"
            ],

it works for me... usually.

Jia-Wang Chen

unread,
Dec 5, 2024, 2:07:46 AM12/5/24
to ns-3-users

Thank you very much for your help, I successfully solved the first problem with your help, but the problem about the missing header files of the program is still not solved.
First of all, before asking you questions, I have installed CMake Tools and C/C++ extensions in vscode, but the problem of header files not being recognized still occurs; after that, I followed your method to change the includePath of c_cpp_properties.json to “includePath”: [

                “${workspaceFolder}/build/include/”,
                “${workspaceFolder}/src/**]
However, the file still runs with a header file not found error and even other errors. For your convenience, I have listed the specific contents of c_cpp_properties.json, launch.json,tasks..json in the image below, and I have also listed the error message of the file and the specific path of my folder in the image below, so I hope that you can take a look to see where the problem is. Finally, thank you again for your help, I wish you a happy life and good luck in your work.
There may be a few too many pictures, sorry for the delay!1.png2.png3.png4.png5.png6.png7.png8.png9.png10.png11.png12.png18.png
After I clicked on “debug anyway” I got the error shown above19.png

Tommaso Pecorella

unread,
Dec 5, 2024, 3:43:32 AM12/5/24
to ns-3-users
I think your "tasks.json" is messed up a bit.

The default one for ns-3.43 is:
--------------------
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "./ns3",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Run tests",
            "type": "shell",
            "command": "./test.py",
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}
--------------------

Note that the two issues (not detecting the headers and failing to launch scripts) might be unrelated.

Gabriel Ferreira

unread,
Dec 5, 2024, 6:12:34 AM12/5/24
to ns-3-users
Ah, this is why I hate vscode. Stop using launch.json. Open the CMake extension. It should show a list of targets. Right-click and select want you want to build/run/debug.
You either didn't configure CMake yet, or it failed. The *-module.h headers during configuration. But launch.json doesn't know that, nor does VSCode.

Here is how to use
https://youtu.be/Ab8eYHhT5I8

Jia-Wang Chen

unread,
Dec 5, 2024, 6:24:49 AM12/5/24
to ns-3-users

Okay,I'll give it a try. Thank you very much!!!
Reply all
Reply to author
Forward
0 new messages