求助求助!!!C++源代码编译成功,组建出现LNK error的问题

诺森德5 2018-07-17 02:18:17
一个程序,编译显示成功了,但是Linking的时候跳出来78个错误,全是error LNK2001: unresolved external symbol 这种,试了下把工程的设置改了后没有效果。求助各路大神,万分感谢!
--------------------Configuration: Dndc_main - Win32 Debug--------------------
Linking...
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_wb(int,char *,char *)" (?write_out_wb@class_model@@QAEHHPAD0@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::write_globe_summary(int,float,char *,int,int,int,char *,char *,int,int,int,char *,int,int,int,int,int,char *,int,int,int,char (* const)[150],char *,int,i
nt)" (?write_globe_summary@class_model@@QAEXHMPADHHH00HHH0HHHHH0HHHQAY0JG@D0HH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_cropini(int)" (?write_out_cropini@class_model@@QAEHH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::write_BatchSummary(int,char *,char *)" (?write_BatchSummary@class_model@@QAEXHPAD0@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::write_MonteCarlo(int,int,char *)" (?write_MonteCarlo@class_model@@QAEXHHPAD@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_annual_report(int,float,int,int,struct _iobuf *,struct _iobuf *,int,float *,float *,int,char *,char *,char *)" (?write_out_annual_report@class_m
odel@@QAEHHMHHPAU_iobuf@@0HPAM1HPAD22@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_soil_parm(int,int,int)" (?write_out_soil_parm@class_model@@QAEHHHH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::annu_accumu(void)" (?annu_accumu@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::MC_annu_accumu(void)" (?MC_annu_accumu@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::paint(struct MODEL_LINK_INFO *,int,int,char *)" (?paint@class_model@@QAEXPAUMODEL_LINK_INFO@@HHPAD@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_daymicrobe(struct _iobuf *)" (?write_out_daymicrobe@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_daysp(struct _iobuf *)" (?write_out_daysp@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_daym(struct _iobuf *)" (?write_out_daym@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_dayg(struct _iobuf *)" (?write_out_dayg@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_dayn(struct _iobuf *)" (?write_out_dayn@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_dayc(struct _iobuf *)" (?write_out_dayc@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_dayw(struct _iobuf *,float)" (?write_out_dayw@class_model@@QAEHPAU_iobuf@@M@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::write_out_dayClim(struct _iobuf *,int,char *,int,float,float,float,float,float)" (?write_out_dayClim@class_model@@QAEXPAU_iobuf@@HPADHMMMMM@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_dayp(struct _iobuf *)" (?write_out_dayp@class_model@@QAEHPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: int __thiscall class_model::write_out_days(struct _iobuf *,float)" (?write_out_days@class_model@@QAEHPAU_iobuf@@M@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::cn_pools(float,float,float,float,float,float,float)" (?cn_pools@class_model@@QAEXMMMMMMM@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::ReDefineION(void)" (?ReDefineION@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::Substrate_leaching(int)" (?Substrate_leaching@class_model@@QAEXH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: float __thiscall class_model::CH4_paddy(int,int,float *,float *,int,int,float *,int,float *,float *,float *,int,float *,float *,float,float,int,float *,float *,float *,int *,float,fl
oat,float,float,float *,int,float,float *,float *,float *,float *,float *,float *,float *,int *,float *,float *,float,float *,float *,float,float *,float *,float *,float,float *,float *,int,float *,int,float,float *,float *,float *,float *,float *,f
loat,float *,int,float,float,float,float *)" (?CH4_paddy@class_model@@QAEMHHPAM0HH0H000H00MMH000PAHMMMM0HM0000000100M00M000M00H0HM00000M0HMMM0@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: float __thiscall class_model::CH4_peat(int,int,float *,float *,int,int,float *,int,float *,float *,float *,int,float *,float *,float *,float,int,float *,float *,float *,int *,float,f
loat,float,float,float *,int,float,float *,float *,float *,float *,float *,float *,float *,int *,float *,float *,float,float *,float *,float,float *)" (?CH4_peat@class_model@@QAEMHHPAM0HH0H000H000MH000PAHMMMM0HM0000000100M00M0@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::saturation_Eh(void)" (?saturation_Eh@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::annu_water_budget(float)" (?annu_water_budget@class_model@@QAEXM@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::dryland_ch4_oxidation(void)" (?dryland_ch4_oxidation@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::riceland_ch4_oxidation(void)" (?riceland_ch4_oxidation@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::dndc_decomposition(float *,float *,float *,float *,float *,float *,float *,float *,float *,float,float *,int,struct _iobuf *,struct _iobuf *,float *,floa
t *,int,int,float,float,float,float,float,float,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,int,float *,float *,float,int,float *,int,float *,int,int,float *,float *
,float *,float *,float *,float *,float *,float *,float,float *,float *,int *,float,float,float,float *,int,float,float *,float *,float *,float *,float *,float,float,float,float *,float *,float *,float *,float *,float *,float *,float *,float,float,fl
oat *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float,float *,float *,float *,float *,float *,float *,float *,int *,float *,float,float *,float *,float *,int,float *,float *,float
,float *,float *,float *,float *,float *,float *,float *,float *,float,float,int,int)" (?dndc_decomposition@class_model@@QAEXPAM00000000M0HPAU_iobuf@@100HHMMMMMM0000000000000000H00MH0H0HH00000000M00PAHMMM0HM00000MMM00000000MM000000000000000M00000002
0M000H00M00000000MMHH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::Mn_Fe_S_oxidation(void)" (?Mn_Fe_S_oxidation@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::N2O_balloon(int,float,float *,float *,int,int,int,float,float *,float *,float,float *,float *,int,int *,float *,int,double (* const)[180],float *,float,i
nt,float,float *,float *,int,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,float *,int,float *,float,int,float
*,float,float,float,int,int *,float *,float *,float *,float,int,int,float *,float *,float *,float *,float *,float *,float *,float,float *,float *,float *,float *,float *,float *,float *,float,float *,float *,float,int,int,float *,float *,float *,flo
at,int,int,struct _iobuf *,int,float,float *,float *,int,int,int,int,float,int,float *,float *,int)" (?N2O_balloon@class_model@@QAEXHMPAM0HHHM00M00HPAH0HQAY0LE@N0MHM00H000000000000000000000000H0MH0MMMH1000MHH0000000M0000000M00MHH000MHHPAU_iobuf@@HM0
0HHHHMH00H@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::NH4_HCO3(void)" (?NH4_HCO3@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::zero_DayFlux(void)" (?zero_DayFlux@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::daily_WT(struct _iobuf *)" (?daily_WT@class_model@@QAEXPAU_iobuf@@@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::crop_growth(int)" (?crop_growth@class_model@@QAEXH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: float __thiscall class_model::potential_et(int)" (?potential_et@class_model@@QAEMH@Z)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::soil_temperature(void)" (?soil_temperature@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::water_temperatue(void)" (?water_temperatue@class_model@@QAEXXZ)
Dndc_main.obj : error LNK2001: unresolved external symbol "public: void __thiscall class_model::init_soil_moisture(void)" (?in
...全文
278 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
诺森德5 2018-07-23
  • 打赏
  • 举报
回复
引用 11 楼 u011646304 的回复:
[quote=引用 10 楼 u013864342 的回复:]
[quote=引用 8 楼 u011646304 的回复:]
[quote=引用 5 楼 u013864342 的回复:]

对,就是提示缺少两个文件,一个是E:\DNDC-2015\Swine\Swine.csproj: 未能加载项目文件。未能找到路径“E:\DNDC-2015\Swine\Swine.csproj”的一部分。
一个是E:\DNDC-2015\SwineLib\SwineLib.vcxproj : error : 未能找到项目“E:\DNDC-2015\SwineLib\SwineLib.vcxproj”。
然后我找到了Swine.cpp,但是没有SwineLib呀,后来调用外部lib文件怎么解决的呀

这说明这个解决方案以前是有SwineLib这个工程的,后来可能被删除掉了,那么Swine.Lib也没有生成,所以调用的SwineLib中的函数都找不到实现了。你看看Swine.cpp中是否有这些函数的实现,如果有的话直接把Swine.cpp添加到编译不过的工程里面就可以了。[/quote]怎么添加呀?老哥能加个联系方式吗?分都给你[/quote]
QQ给我我加你[/quote]379847900
陆人葭 2018-07-20
  • 打赏
  • 举报
回复
引用 10 楼 u013864342 的回复:
[quote=引用 8 楼 u011646304 的回复:]
[quote=引用 5 楼 u013864342 的回复:]

对,就是提示缺少两个文件,一个是E:\DNDC-2015\Swine\Swine.csproj: 未能加载项目文件。未能找到路径“E:\DNDC-2015\Swine\Swine.csproj”的一部分。
一个是E:\DNDC-2015\SwineLib\SwineLib.vcxproj : error : 未能找到项目“E:\DNDC-2015\SwineLib\SwineLib.vcxproj”。
然后我找到了Swine.cpp,但是没有SwineLib呀,后来调用外部lib文件怎么解决的呀

这说明这个解决方案以前是有SwineLib这个工程的,后来可能被删除掉了,那么Swine.Lib也没有生成,所以调用的SwineLib中的函数都找不到实现了。你看看Swine.cpp中是否有这些函数的实现,如果有的话直接把Swine.cpp添加到编译不过的工程里面就可以了。[/quote]怎么添加呀?老哥能加个联系方式吗?分都给你[/quote]
QQ给我我加你
诺森德5 2018-07-20
  • 打赏
  • 举报
回复
引用 8 楼 u011646304 的回复:
[quote=引用 5 楼 u013864342 的回复:]

对,就是提示缺少两个文件,一个是E:\DNDC-2015\Swine\Swine.csproj: 未能加载项目文件。未能找到路径“E:\DNDC-2015\Swine\Swine.csproj”的一部分。
一个是E:\DNDC-2015\SwineLib\SwineLib.vcxproj : error : 未能找到项目“E:\DNDC-2015\SwineLib\SwineLib.vcxproj”。
然后我找到了Swine.cpp,但是没有SwineLib呀,后来调用外部lib文件怎么解决的呀

这说明这个解决方案以前是有SwineLib这个工程的,后来可能被删除掉了,那么Swine.Lib也没有生成,所以调用的SwineLib中的函数都找不到实现了。你看看Swine.cpp中是否有这些函数的实现,如果有的话直接把Swine.cpp添加到编译不过的工程里面就可以了。[/quote]怎么添加呀?老哥能加个联系方式吗?分都给你
诺森德5 2018-07-18
  • 打赏
  • 举报
回复

对,就是提示缺少两个文件,一个是E:\DNDC-2015\Swine\Swine.csproj: 未能加载项目文件。未能找到路径“E:\DNDC-2015\Swine\Swine.csproj”的一部分。
一个是E:\DNDC-2015\SwineLib\SwineLib.vcxproj : error : 未能找到项目“E:\DNDC-2015\SwineLib\SwineLib.vcxproj”。
然后我找到了Swine.cpp,但是没有SwineLib呀,后来调用外部lib文件怎么解决的呀
_肆 2018-07-18
  • 打赏
  • 举报
回复
我在使用调用外部lib库文件的时候倒是会遇到这个问题,就是lib的路径没写对,然后认为库里面的函数是无法识别的外部符号
_肆 2018-07-18
  • 打赏
  • 举报
回复
我用的编译器是vs,是在左上角 项目->"你的项目名称"属性(最下面)->配置属性->链接器->输入->附加依赖库 在这里加入你lib所在的路径 比如.\xxx.lib ,这个叫LIB库的隐式调用

也有可能是他程序里调用了,然后你copy过来的程序和他的环境配置不一样,路径下没有这个库,或者路径改变了和他不一致,隐式是在属性配置里,显示调用就直接在.cpp里面写了代码,lib库的调用应该就这两种

再者不一定是lib的问题,好比你把D盘的项目放到桌面了,然后去编译,有的路径改变了,就会说你缺这缺那,报看不懂的错
陆人葭 2018-07-18
  • 打赏
  • 举报
回复
引用 5 楼 u013864342 的回复:
对,就是提示缺少两个文件,一个是E:\DNDC-2015\Swine\Swine.csproj: 未能加载项目文件。未能找到路径“E:\DNDC-2015\Swine\Swine.csproj”的一部分。
一个是E:\DNDC-2015\SwineLib\SwineLib.vcxproj : error : 未能找到项目“E:\DNDC-2015\SwineLib\SwineLib.vcxproj”。
然后我找到了Swine.cpp,但是没有SwineLib呀,后来调用外部lib文件怎么解决的呀

这说明这个解决方案以前是有SwineLib这个工程的,后来可能被删除掉了,那么Swine.Lib也没有生成,所以调用的SwineLib中的函数都找不到实现了。你看看Swine.cpp中是否有这些函数的实现,如果有的话直接把Swine.cpp添加到编译不过的工程里面就可以了。
诺森德5 2018-07-18
  • 打赏
  • 举报
回复
引用 2 楼 u011646304 的回复:
link错误,说明编译器根据符号找不到函数的实现,是不是相关的库没有链接进来,或者函数声明了没有实现,或者实现该函数的代码没有加进该工程。
库没有链接进来,那应该怎么做呢?这是个别人编好的,语法应该没有啥问题的
诺森德5 2018-07-18
  • 打赏
  • 举报
回复
引用 4 楼 qq_38319117 的回复:
我在使用调用外部lib库文件的时候倒是会遇到这个问题,就是lib的路径没写对,然后认为库里面的函数是无法识别的外部符号
那么后面怎么解决的呀?求助~!
l357630798 2018-07-17
  • 打赏
  • 举报
回复
缺少函数的实现部分,检查库或者cpp里面有不有函数的实现。
陆人葭 2018-07-17
  • 打赏
  • 举报
回复
link错误,说明编译器根据符号找不到函数的实现,是不是相关的库没有链接进来,或者函数声明了没有实现,或者实现该函数的代码没有加进该工程。
诺森德5 2018-07-17
  • 打赏
  • 举报
回复

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧