Je suis novice en matière de CLI C++ provenant du monde C++ non géré.Erreur CLI C++ C3767: fonction (s) candidate (s) non accessible (s)
Je reçois cette erreur:
candidate function(s) not accessible
quand je passe un std :: string dans le cadre de l'argument de la méthode.
Voici le code exact:
Projet Lib (compilé en tant que projet .dll)
//Lib.h
#pragma once
public ref class Lib
{
public:
Lib(void);
public:
void Extract(std::string& data_);
};
//Lib.cpp
#include "Lib.h"
Lib::Lib(void)
{
}
void Lib::Extract(std::string& data_)
{
data_.empty();
}
Projet LibTest (compilé en tant que appl ication.exe)
// LibTest.h
#pragma once
ref class LibTest
{
public:
LibTest(void);
};
// LibTest.cpp
#include "LibTest.h"
LibTest::LibTest(void)
{
Lib^ lib = gcnew Lib;
lib->Extract(std::string("test"));
}
int main()
{
return 0;
}
compilateur Erreur:
1>------ Build started: Project: LibTest, Configuration: Debug Win32 ------
1>Compiling...
1>LibTest.cpp
1>.\LibTest.cpp(7) : error C3767: 'Lib::Extract': candidate function(s) not accessible
merci, cela a résolu mon problème – weidi