Здравствуйте, я программирую на Visual C ++ 2010 (испанский) с UNICODE и / clr.У меня есть файл заголовка с именем "fileFuncs.h":
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <string>
using namespace std;
std::wstring s2ws(const std::string& s)
{
int len;
int slength = (int)s.length() + 1;
len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
std::wstring r(buf);
delete[] buf;
return r;
}
void callSystem(string sCmd){
std::wstring stemp = s2ws(sCmd);
LPCWSTR params = stemp.c_str();
ShellExecute(NULL,L"open",L"c:\\windows\\system32\\cmd.exe /S /C ",params,NULL,SW_HIDE);
}
Но при компиляции выдают следующие ошибки:
ошибка LNK2028: относится к неразрешенному символу(токен) (0A0004A5) "extern" C "struct HINSTANCE__ * stdcall ShellExecuteW (struct HWND *, wchar_t const *, wchar_t const *, wchar_t const *, wchar_t const *, int)" (? ShellExecuteW @@ $$ J224YGPAUHINSTANCE_ @@ PAUHWND _ @@ PB_W111H @ Z) в функции "void __cdecl callSystem (класс std :: basic_string, класс std :: allocator>)" (? CallSystem @@ $$ FYAXV? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@
ошибка LNK2019: внешний символ "extern" C "structHINSTANCE__ * stdcall ShellExecuteW (struct HWND *, wchar_t const *, wchar_t const *, wchar_t const *, wchar_t const *, int) "(? ShellExecuteW @@ $$ J224YGPAUHINSTANCE_ @* _ @@ PB_W111H @ Z) неразрешенная функция, указанная в функции «void __cdecl callSystem (class std :: basic_string, classstd :: allocator)» »(? CallSystem @@ $$ FYAXV?$ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@@ Z) * 1020 *
Это какой-то тип конфигурации?