将IUP与Visual Studio静态链接

时间:2018-06-21 08:33:59

标签: c visual-studio linker-errors iup

我已经下载了IUP iup-3.25_Win64_vc15_lib.zip(他们提供的最新x64位VS版本)文件,并将其解压缩到我的项目中(位于名为Library的子文件夹中)。我正在尝试编译以下内容:

#include "Librarty/include/iup.h"


int main(int argc, char **argv) {

    IupOpen(&argc, &argv);

    IupMessage("TEST", "Test App");

    IupClose();
    return 0;
}

我通过选择

将路径添加到头文件中
Project > Properties > Additional Include Libraries > File path

它设置为Library/include

接下来,我通过以下方式添加了.lib文件:

Project > Properties > Linker > Additional Library Dictionaries

this答案中选取的方法。

最后,我通过以下方式添加了.rc文件:

Under Solutions Explorer > Project Name > Add Existing Item > Given File Path 

将其设置为Library/ext/iup.rc

然后我尝试编译我的项目,并收到以下错误(我已将编译器设置为x64版本):

1>------ Build started: Project: IUP, Configuration: Release x64 ------
1>main.c
1>main.obj : error LNK2001: unresolved external symbol IupOpen
1>main.obj : error LNK2001: unresolved external symbol IupMessage
1>main.obj : error LNK2001: unresolved external symbol IupClose
1>C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "IUP.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

要构建它,我需要做什么?

项目路径:

C:\Users\Simon\Desktop\Learn\IUP\

IUP库:

C:\Users\Simon\Desktop\Learn\IUP\Library

编辑:完整的链接器:

/OUT:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.exe" /MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /OPT:REF /PGD:"C:\Users\Simon\Desktop\Learn\IUP\x64\Release\IUP.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\IUP.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Users\Simon\Desktop\Learn\IUP\Librarty" /TLBID:1

0 个答案:

没有答案