9 years, 2 months ago.

Cannot open source

I created new empty program in online compiler. I then added main.cpp file to it and fill main.cpp file with code from here: https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/communication/network_sockets/

I clicked compile and I get:

Cannot open source input file mbed.h

Why and how to make the network sockets example working?

1 Answer

9 years, 2 months ago.

You'll need to add the mbed-os library to your program.

Right click on the project in the tree > New library > From URL, and https://github.com/armmbed/mbed-os. You'll also need to enable the network features by adding an mbed_app.json file and filling it with something like https://github.com/ARMmbed/easy-connect/blob/master/mbed_lib.json.

Although it would be easier to just import an example program, so everything is set up correctly.