Dmitriy Savin
Dmitriy Savin

Reputation: 143

No matching function for call (type&)

guys! I got an error while compiling of project

LoadConnectorModule.cpp:59:72: error: no matching function for call to ‘LoadConnectorModule::generateFileFoundResponse(char*&, int&, char ( * )[1024], int&)’
         generateFileFoundResponse(dataBuffer, dataLength, &fileName, fd);
                                                                        ^
LoadConnectorModule.cpp:59:72: note: candidate is:
In file included from LoadConnectorModule.cpp:1:0:
LoadConnectorModule.h:16:10: note: void LoadConnectorModule::generateFileFoundResponse(char*, int, char*, int)
     void generateFileFoundResponse(char* dataBuffer, int dataLength, char *fileName, int fd);

The function generateFileFoundResponse is called here

        char * dataBuffer = NULL;
        char fileName[Utils::default_message_size];
        int dataLength;
        generateFileFoundResponse(dataBuffer, dataLength, &fileName, fd);

and is declared as

    void generateFileFoundResponse(char* dataBuffer, int dataLength, char *fileName, int fd);

And there is the same error for all other methods in this class. Do you have any ide, how to solve this problem?

Upvotes: 0

Views: 348

Answers (1)

TartanLlama
TartanLlama

Reputation: 65640

The fileName parameter is a char*, but you pass a char (*) [1024] (pointer to array). Just pass the array itself and let it decay to a pointer:

generateFileFoundResponse(dataBuffer, dataLength, fileName, fd);
//                                                ^ no &

Upvotes: 1

Related Questions