Esp32 using WiFiServer in Main and module: How to define

I want to use WiFiServer in main.cpp and in module.cpp.

I declare it in main.cpp:
#include “main.h”
WiFiServer server(80);’

and in main.h:
`#ifndef main_h
#define main_h

#include <WiFi.h>
extern WiFiServer server(80);

#endif // main_h

In module “module.cpp”:
#include <main.h>

WiFiClient client = server.available();   // Listen for incoming clients

I get the following error:
redefinition of ‘WiFiServer server’

How to resolve this ?

No constructor arguments in the extern declaration. You just delcare its type and name, how it’s constructed should not be written here.

Oke, that’s the way to do it.

Thank you very much.