Arm Mbed OS support forum

Too many arguments to function call, expected single argument 'address', have 2 arguments

Hello,

I am trying to build the official example:
mbed-os-example-tls/tls-client at master · ARMmbed/mbed-os-example-tls · GitHub.

i am getting error in the: HelloHttpsClient.cpp file.

Compile [ 2.0%]: main.cpp
Compile [ 2.1%]: HelloHttpsClient.cpp
[Error] HelloHttpsClient.cpp@113,44: too many arguments to function call, expected single argument ‘address’, have 2 arguments
[Warning] HelloHttpsClient.cpp@182,38: format specifies type ‘unsigned long’ but the argument has type ‘std::uint32_t’ (aka ‘unsigned int’) [-Wformat]
[ERROR] .\HelloHttpsClient.cpp:113:44: error: too many arguments to function call, expected single argument ‘address’, have 2 arguments

Blockquote

if ((ret = socket.connect(server_addr, server_port)) != NSAPI_ERROR_OK) {

./mbed-os/connectivity/netsocket/include\netsocket/TCPSocket.h:63:19: note: 'connect' declared here
nsapi_error_t connect(const SocketAddress &address) override;
^
.\HelloHttpsClient.cpp:182:38: warning: format specifies type 'unsigned long' but the argument has type 'std::uint32_t' (aka 'unsigned int') [-Wformat]
"\n%s\n", flags, gp_buf);
^~~~~
1 warning and 1 error generated.

> Blockquote


I am new to C++. I get the same error while using COMPILER. I have windows 10 machine, and i use MBED STUDIO for development. i use NUCLEO-F767ZI as target.

please help where the syntax error is ??
![Capture|690x370](upload://pHMyh5S4qJHmoJSeNQxyci7OHnW.jpeg)

Hello,

are you sure you use exactly this example?
When you check HelloHttpsClient.cpp line 113 (latest) there is connect method with one argument what corresponding with documentation.

It seems you use version for MbedOS 5.15 HelloHttpsClient.cpp line 113 (5.15)

So, from my point of view, you need to downgrade the MbedOS to 5.15 or reimport the example from the link what you posted above where is MbedOS 6+ probably.

BR, Jan

Hello,
You are correct.
i downloaded the github project into local PC.
Then opened an empty OS6 project, and started adding the TLS-Client example program. It worked. Had issues using PyOCD to flash the binary; but just copy pasted and the bin file & the program works fine in my board. thanks for this.

i do know where the mistake is. The link behind the “project” highlighted takes to a spot where the program is not OS6 i guess. however, the main github itself is OS6. Strange.