我的c头文件是这么写的
#ifdef __cplusplus
extern "C" {
#endif
extern int shmdb_initParent(STHashShareHandle *handle,unsigned int size);
#ifdef __cplusplus
}
#endif
我的c++代码是这么写的
//引用头文件
extern "C" {
#include "mm.h"
}
//调用代码
int rv = shmdb_initParent(&obj->_handle,obj->counter_);
然后编译c++代码的时候被报出错误
int rv = shmdb_initParent(&obj->_handle,obj->counter_);
编译错误信息:
D:\temp\addone\cpp2node>node-gyp configure build --msvs_version=2012
gyp info it worked if it ends with ok
gyp info using node-gyp@0.13.0
gyp info using node@0.10.17 | win32 | x64
gyp info spawn python
gyp info spawn args [ 'C:\\Users\\sunny\\AppData\\Roaming\\npm\\node_modules\\no
de-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=2012',
gyp info spawn args '-I',
gyp info spawn args 'D:\\temp\\addone\\cpp2node\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sunny\\AppData\\Roaming\\npm\\node_modules\\no
de-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sunny\\.node-gyp\\0.10.17\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\sunny\\.node-gyp\\0.10.17',
gyp info spawn args '-Dmodule_root_dir=D:\\temp\\addone\\cpp2node',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\\temp\\addone\\cpp2node\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn msbuild
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
LINK : fatal error LNK1181: 无法打开输入文件“lib\shmdb.lib” [D:\temp\addone\cp
p2node\bu
ild\shmdb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\sunny\AppData\Roaming\npm\no
de_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Users\\sunny\\AppData\\Roaming\\npm\\node_modules\\
node-gyp\\bin\\node-gyp.js" "configure" "build" "--msvs_version=2012"
gyp ERR! cwd D:\temp\addone\cpp2node
gyp ERR! node -v v0.10.17
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。