linking libeng.lib problem in VC++ 2010
Afficher commentaires plus anciens
I am trying to write a C++ program using MS VC++ 2010 on Windows 7 64-bit. I have a Matlab 2011 and configured all. Set Include and lib path in Windows environment variable, run matlab as a com server, include all library and include info in vc++ project settings but still the linker say:
Warning 1 warning LNK4248: unresolved typeref token (0100000B) for 'engine'; image may not run C:\Users\Administrator\Documents\Visual Studio 2010\Projects\TestMatlabAppWin64\TestMatlabAppWin64\TestMatlabAppWin64.obj TestMatlabAppWin64
Error 2 error LNK2028: unresolved token (0A000008) "extern "C" struct engine * __cdecl engOpen(char const *)" (?engOpen@@$$J0YAPAUengine@@PBD@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Users\Administrator\Documents\Visual Studio 2010\Projects\TestMatlabAppWin64\TestMatlabAppWin64\TestMatlabAppWin64.obj TestMatlabAppWin64
The program I wrote is:
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
Engine* ep=0;
ep=engOpen(NULL);
engClose(ep);
return 0;
}
and the stdafx.h contains:
#pragma once
#pragma comment(lib, "libeng.lib")
// TODO: reference additional headers your program requires here
#include<engine.h>
Réponses (2)
Kaustubha Govind
le 7 Fév 2012
0 votes
Have you configured your Linker properties to the path where libeng.lib is present and also included libeng.lib in the Additional Dependencies? If you still see the same error, make sure that your VC++ project is configured to compile for a 64-bit target (by default, it compiles a 32-bit binary which cannot link against a 64-bit libeng.lib).
Friedrich
le 7 Fév 2012
0 votes
Hi,
I would suggest following this awesome solution:
Catégories
En savoir plus sur C Shared Library Integration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!