出现fatal error LNK1120: 1 unresolved externals的原因

Error        5        error LNK1120: 3 unresolved externals        D:\Code\simpleTest- mqo \Debug\simpleTest- mqo .exe        1        1        simpleTest- mqo
Error        4        error LNK2019: unresolved external symbol _ mqo CallModel referenced in function "void __cdecl draw(void)" (?draw@@YAXXZ)        D:\Code\simpleTest- mqo \simpleTest- mqo \ mqo test.obj        simpleTest- mqo
Error        2        error LNK2019: unresolved external symbol _ mqo CreateModel referenced in function "void __cdecl init(void)" (?init@@YAXXZ)        D:\Code\simpleTest- mqo \simpleTest- mqo \ mqo test.obj        simpleTest- mqo
Error        3        error LNK2019: unresolved external symbol _ mqo Init referenced in function "void __cdecl init(void)" (?init@@YAXXZ)        D:\Code\simpleTest- mqo \simpleTest- mqo \ mqo test.obj        simpleTest- mqo
Warning        1        warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library        D:\Code\simpleTest- mqo \simpleTest- mqo \LINK        simpleTest- mqo


只包含了头文件,但是缺少相应的库文件,导致函数只有声明没有实现。

而我遇到的问题是,有h文件和c文件,并没有lib和dll!!!

百思不得其解,向同事求助,终于发现问题所在,我把c文件跟头文件一起放在include中,link时无法找到函数定义,故而报错。解决方法,将h文件和c文件都add到project中。

你可能感兴趣的:(出现fatal error LNK1120: 1 unresolved externals的原因)