namespace CommunicatorApi
{
class ApiObserver;
class COMM_API_EXPORT Api
{
public:
//! Basic constructor
Api(ApiObserver& observer);
//! Destructs the object and frees resources allocated by it
~Api();
}
}
調用構造我想打電話給爲結構類
#include <iostream>
#include "include/communicator_api.h"
using namespace std;
int main()
{
cout << "Hello, world, from Visual C++!" << endl;
CommunicatorApi::Api::Api();
}
但是我很recieveing錯誤
CommunicatorApi::Api::Api no approprate default constructor available
正如錯誤所述,您沒有默認構造函數,因此您不能默認構造類的實例。 –
來自編譯器的錯誤消息非常明確。您沒有類「Api」的默認構造函數,但您正嘗試使用它來構造一個對象。 –
另一個問題:你想做什麼?可能是這樣的:CommunicatorApi :: Api api(); – KonstantinL