wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wget2 | Failed to link libwget for C++ modules (#612)


From: Michael Lee (@michael2e2)
Subject: wget2 | Failed to link libwget for C++ modules (#612)
Date: Wed, 10 Aug 2022 14:54:46 +0000


Michael Lee created an issue: https://gitlab.com/gnuwget/wget2/-/issues/612



On some platforms that have C++ compiler, dynamic linking against `libwget.so` 
is reported failed.

For example, the following program just performs a simple `wget_http_get` API 
invocation:

```cpp
// tst_wget201_httpget.cc
#include <iostream>
#include <wget.h>

#define URL "https://www.w3.org/";

int main(void)
{
  using namespace std;
  wget_http_response* resp;
  
  resp = wget_http_get(WGET_HTTP_URL, URL, 0);

  if (resp) {   // buffers are always 0 terminated
    cout << "Response from " << URL << endl;
    cout << "HTTP resp code: " << resp->code << endl;
  }

  wget_http_free_response(&resp);
  return 0;
}
```

Compiled with 
```bash
g++ tst_wget201_httpget.cc -I$MYPREFIX/include -L$MYPREFIX/lib -lwget 
-Wl,-rpath,$MYPREFIX/lib
```

Compiler complains:
```bash
include/wget.h:334:47: error: expected ‘,’ or ‘...’ before ‘src’
  334 |  wget_memtohex(const unsigned char * restrict src, size_t src_len, char 
* restrict dst, size_t dst_size);
      |                                               ^~~

include/wget.h:356:54: error: expected ‘,’ or ‘...’ before ‘fmt’
  356 |  wget_vpopenf(const char *type, const char *restrict fmt, va_list args) 
WGET_GCC_PRINTF_FORMAT(2,0);
      |                                                      ^~~


(... other similar error)
```

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/-/issues/612
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]