0

I have downloaded the IUP iup-3.25_Win64_vc15_lib.zip (the latest x64 bit VS version they provided) file and have extracted it to my project (in a sub folder called Library). I am trying to compile the following:

#include "Librarty/include/iup.h"


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

    IupOpen(&argc, &argv);

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

    IupClose();
    return 0;
}

I have added the path to the header files by selecting

Project > Properties > Additional Include Libraries > File path

It is set to Library/include

Next I have added the .lib files by:

Project > Properties > Linker > Additional Library Dictionaries

The method taken from this answer.

Finally I added the .rc file by:

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

Set that to Library/ext/iup.rc

I then tried to compile my project and got the following error (I have set the compiler to x64 release):

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 ==========

What do I need to do to get it to build?

Project Path:

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

IUP library:

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

EDIT: complete linker:

/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
Xantium
  • 11,201
  • 10
  • 62
  • 89
  • 1
    Make sure the library you specified in the additional dependencies line is a 64-bit file (as that is what you are attempting to build). Binaries cannot be shared between 32 and 64 bit builds. If you actually want this project to build for all configurations you will need to go into the project settings and add an appropriate library for each platform. – SoronelHaetir Jun 21 '18 at 09:39
  • @SoronelHaetir Ah sorry pherhaps I was not clear enough. The zip I downloaded was x64 and I am using x64 release in VS so no unfortunately that is not the issue here. :( – Xantium Jun 21 '18 at 09:47
  • One common error in Visual Studio is to edit the properties of the Debug target, and build the Release target. Is there a more complete command line for the linker? I can't see the libs being used on your post. – Antonio Scuri Jun 21 '18 at 17:14
  • @AntonioScuri That was the entire output when I pressed build. How can I get a list of the libs? – Xantium Jun 21 '18 at 18:03
  • 1
    Right click the project in the tree, Properties then Linker, then Command Line. Notice again that there is 4 possible combinations Debug/Release + Win32/x64. It is quite common to set the options in one configuration and build using another. – Antonio Scuri Jun 22 '18 at 20:41
  • I added the linker from Command Line into my post. @AntonioScuri – Xantium Jun 23 '18 at 16:10
  • Notice that iup.lib is not listed in the command line. I suggest you check your project configuration again. – Antonio Scuri Jun 24 '18 at 17:23
  • I tried Project > Linker > Input > Additional Dependencies > iup.lib it came up with an error @AntonioScuri – Xantium Jun 24 '18 at 17:56
  • 1>iup.lib(iupwin_open.obj) : error LNK2001: unresolved external symbol __imp_InitCommonControlsEx 1>iup.lib(iupwin_list.obj) : error LNK2001: unresolved external symbol __imp_MakeDragList 1>iup.lib(iupwin_list.obj) : error LNK2001: unresolved external symbol __imp_LBItemFromPt 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Create 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Create 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Destroy – Xantium Jun 24 '18 at 17:57
  • 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Destroy 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_GetImageCount 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_GetImageCount 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Add 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Add 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_Draw – Xantium Jun 24 '18 at 17:57
  • 1>iup.lib(iupwin_tabs.obj) : error LNK2001: unresolved external symbol __imp_ImageList_GetImageInfo 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_BeginDrag – Xantium Jun 24 '18 at 17:58
  • 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_EndDrag 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_DragEnter 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_DragLeave 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_DragMove 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_DragShowNolock 1>iup.lib(iupwin_tree.obj) : error LNK2001: unresolved external symbol __imp_ImageList_GetIconSize – Xantium Jun 24 '18 at 17:58
  • 1
    I did as you suggested for dynamically linking a DLL and it worked. I can't seem to get it working for static lonking though. – Xantium Jun 24 '18 at 22:52
  • Take a look at the "Building Application" page in the IUP documentation. You will see that comctl32.lib is necessary. – Antonio Scuri Jun 25 '18 at 21:20

0 Answers0