I have two projects the first is c++ console application and the second is c++ CLR Empty project .I want to call function from the console and use it in CLR project .I tried to create header file , include it in CLR project and use #include "headername.h" and call the function render3d() but it gives me those linking errors .
我有两个项目,第一个是c ++控制台应用程序,第二个是c ++ CLR Empty项目。我想从控制台调用函数并在CLR项目中使用它。我试图创建头文件,将它包含在CLR项目中并使用#include “headername.h”并调用函数render3d()但它给了我那些链接错误。
Error 29 error LNK2028: unresolved token (0A000934) "void __cdecl render3d(void)" (?render3d@@$$FYAXXZ) referenced in function "private: void __clrcall DEMO::MainForm::AddAnimebutton_Click(class System::Object ^,class System::EventArgs ^)" (?AddAnimebutton_Click@MainForm@DEMO@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) E:\Graduation Project\CPP ARENA DEMO New Design\DEMO\DEMO\MainForm.obj DEMO
错误29错误LNK2028:未解析的令牌(0A000934)“void __cdecl render3d(void)”(?render3d @@ $$ FYAXXZ)在函数“private:void __clrcall DEMO :: MainForm :: AddAnimebutton_Click(类System :: Object ^, class System :: EventArgs ^)“(?AddAnimebutton_Click @ MainForm @ DEMO @@ $$ FA $ AAMXP $ AAVObject @ System @@ P $ AAVEventArgs @ 4 @@ Z)E:\ Graduation Project \ CPP ARENA DEMO New Design \ DEMO \ DEMO \ MainForm.obj DEMO
Error 30 error LNK2019: unresolved external symbol "void __cdecl render3d(void)" (?render3d@@$$FYAXXZ) referenced in function "private: void __clrcall DEMO::MainForm::AddAnimebutton_Click(class System::Object ^,class System::EventArgs ^)" (?AddAnimebutton_Click@MainForm@DEMO@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) E:\Graduation Project\CPP ARENA DEMO New Design\DEMO\DEMO\MainForm.obj DEMO
错误30错误LNK2019:在函数“private:void __clrcall DEMO :: MainForm :: AddAnimebutton_Click(类System :: Object ^,类System :: EventArgs ^)“(?AddAnimebutton_Click @ MainForm @ DEMO @@ $$ FA $ AAMXP $ AAVObject @ System @@ P $ AAVEventArgs @ 4 @@ Z)E:\ Graduation Project \ CPP ARENA DEMO New Design \ DEMO \ DEMO \ MainForm.obj DEMO
Error 31 error LNK1120: 2 unresolved externals E:\Graduation Project\CPP ARENA DEMO New Design\DEMO\Release\DEMO.exe DEMO
错误31错误LNK1120:2个未解析的外部E:\ Graduation Project \ CPP ARENA DEMO New Design \ DEMO \ Release \ DEMO.exe DEMO
1 个解决方案
#1
0
You probably have to create a library containing the function you want to call and add a dependency between the projects. Your visual studio solution would then contain 3 projects:
您可能必须创建一个包含要调用的函数的库,并在项目之间添加依赖项。您的Visual Studio解决方案将包含3个项目:
- library with render3d function
- console application which references the above library
- CLR empty project which references the above library
具有render3d函数的库
控制台应用程序引用上面的库
CLR空项目引用上面的库
#1
0
You probably have to create a library containing the function you want to call and add a dependency between the projects. Your visual studio solution would then contain 3 projects:
您可能必须创建一个包含要调用的函数的库,并在项目之间添加依赖项。您的Visual Studio解决方案将包含3个项目:
- library with render3d function
- console application which references the above library
- CLR empty project which references the above library
具有render3d函数的库
控制台应用程序引用上面的库
CLR空项目引用上面的库