当我尝试使用我的 dll 中的函数时出现问题
problem when i try to use function from my dll
我在尝试使用我的 dll 中的函数时遇到问题
我按照这里所说的做了一切:
https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=vs-2019
但是当我尝试 运行 测试应用程序时,我收到以下错误消息:
这是我的全部代码:
test.cpp:
#include "pch.h"
#include <iostream>
#include "SP_DLL.h"
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
int main()
{
symbol_count();
}
dlltest.h:
#pragma once
#include <iostream>
using namespace std;
extern "C" _declspec(dllexport) bool symbol_count();
dlltest.cpp:
#include "pch.h"
#include "SP_DLL.h"
bool symbol_count()
{
char str[100];
char symbol;
size_t count = 0;
cout << "Enter string: ";
cin >> str;
cout << endl << "Enter symbol to count: ";
cin >> symbol;
for each (auto el in str)
if (el = symbol) count++;
return true;
}
如果有帮助:当我尝试 运行 清空 symbol_count() (func 只有代码 {return true;} 而 dll 没有包含)有唯一找不到的 .dll。
I suggestyou could try to downloaded the installed packages from C++ Runtime v14 framework package for Desktop Bridge (Project Centennial),which provided the "msvcp140_app.dll". And then copied "msvcp140_app.dll" from the "C:\ProgramFiles\WindowsApps\Microsoft.VCLibs.140.00____8wekyb3d8bbwe " directory, placed it into your project folder.
– Jeaninez - MSFT 11 月 8 日 2:25
我在尝试使用我的 dll 中的函数时遇到问题
我按照这里所说的做了一切: https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=vs-2019
但是当我尝试 运行 测试应用程序时,我收到以下错误消息:
这是我的全部代码:
test.cpp:
#include "pch.h"
#include <iostream>
#include "SP_DLL.h"
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
int main()
{
symbol_count();
}
dlltest.h:
#pragma once
#include <iostream>
using namespace std;
extern "C" _declspec(dllexport) bool symbol_count();
dlltest.cpp:
#include "pch.h"
#include "SP_DLL.h"
bool symbol_count()
{
char str[100];
char symbol;
size_t count = 0;
cout << "Enter string: ";
cin >> str;
cout << endl << "Enter symbol to count: ";
cin >> symbol;
for each (auto el in str)
if (el = symbol) count++;
return true;
}
如果有帮助:当我尝试 运行 清空 symbol_count() (func 只有代码 {return true;} 而 dll 没有包含)有唯一找不到的 .dll。
I suggestyou could try to downloaded the installed packages from C++ Runtime v14 framework package for Desktop Bridge (Project Centennial),which provided the "msvcp140_app.dll". And then copied "msvcp140_app.dll" from the "C:\ProgramFiles\WindowsApps\Microsoft.VCLibs.140.00____8wekyb3d8bbwe " directory, placed it into your project folder.
– Jeaninez - MSFT 11 月 8 日 2:25