应用程序.cpp
namespace SkyEngine {
__declspec(dllimport)void Print();
}
void main() {
SkyEngine::Print();
}
测试.cpp
#include "Test.h"
#include<stdio.h>
namespace SkyEngine {
void Print() {
printf("Welcome to the Sky Engine!");
}
}
测试.h
#pragma once
namespace SkyEngine {
__declspec(dllexport)void Print();
}
文件的位置附在下面。:
这里是引擎的解决方案文件。
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sandbox", "Sandbox\Sandbox\Sandbox.vcxproj", "{891DE6BF-51D7-4567-AC16-1DB5D2031CBE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkyEngine", "SkyEngine\SkyEngine.vcxproj", "{3B9FCA09-C542-4F44-8107-823A690EF0D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B9FCA09-C542-4F44-8107-823A690EF0D6}.Debug|x64.ActiveCfg = Debug|x64
{3B9FCA09-C542-4F44-8107-823A690EF0D6}.Debug|x64.Build.0 = Debug|x64
{3B9FCA09-C542-4F44-8107-823A690EF0D6}.Release|x64.ActiveCfg = Release|x64
{3B9FCA09-C542-4F44-8107-823A690EF0D6}.Release|x64.Build.0 = Release|x64
{891DE6BF-51D7-4567-AC16-1DB5D2031CBE}.Debug|x64.ActiveCfg = Debug|x64
{891DE6BF-51D7-4567-AC16-1DB5D2031CBE}.Debug|x64.Build.0 = Debug|x64
{891DE6BF-51D7-4567-AC16-1DB5D2031CBE}.Release|x64.ActiveCfg = Release|x64
{891DE6BF-51D7-4567-AC16-1DB5D2031CBE}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {239872E8-05BB-4D0E-A724-11648DD172D0}
EndGlobalSection
EndGlobal
答案 0 :(得分:0)
在我看来,您的构建设置不正确。
dll
构建的。我是怎么得出这个结论的?
“错误”选项卡中的“项目”列显示了引发该错误的项目。第二行显示了要编译到的文件(即“SkyEngine.dll”)。
造成这种情况的主要原因是在链接器可以解析依赖项以链接它之前没有编译导出函数。所以我想你需要做的是,考虑到你正在构建一个游戏引擎,
如果我的假设是正确的,这应该可以解决问题。