c++ 无法生成lib文件 的解决方案

今天生成了一个Win32->Win32 Project->Dll空文件.

VS2008编译后,遇到两个问题:

1.general error c1010070: Failed to load and parse the manifest.

解决方法:添加一个空main(){};

2. fatal error LNK1104: cannot open file '..\debug\sdk_e_x.lib'

无法生成LIB文件

解决方法:

1.添加导出方法

extern "C" int __declspec(dllexport)add(int x, int y);

或者

//#define _DLL_E_X
#ifdef _DLL_E_X
#define DLL_E_X_API __declspec(dllexport)
#else
#define DLL_E_X_API __declspec(dllimport)
#endif

//extern "C" {
class DLL_E_X_API aa
{
};

//}

2.添加.cpp函数实现文件。#include "上面的头文件"

 

参考:

http://www.cnblogs.com/rollenholt/archive/2012/03/20/2409046.html

http://bbs.csdn.net/topics/350172131

 

posted @ 2015-11-02 14:57  AI.Eason  阅读(1338)  评论(0)    收藏  举报