I was trying to compile mpi_prime.c with openmpi on windows. I tried it with the 32bit and 64bit version of OpenMPI_v1.6.2. I got these outputs.
Microsoft (R) C/C++-Optimierungscompiler Version 17.00.61030 für x86
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
mpi_prime.c
Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:mpi_prime.exe
/LIBPATH:C:\Entwicklung\OpenMPI_v1.6.2-x64/lib
libmpi_cxx.lib
libmpi.lib
libopen-pal.lib
libopen-rte.lib
advapi32.lib
Ws2_32.lib
shlwapi.lib
mpicxx mpi_prime.c
Microsoft (R) C/C++-Optimierungscompiler Version 17.00.61030 für x86
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
mpi_prime.c
Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:mpi_prime.exe
/LIBPATH:C:\Entwicklung\OpenMPI_v1.6.2-x64/lib
libmpi_cxx.lib
libmpi.lib
libopen-pal.lib
libopen-rte.lib
advapi32.lib
Ws2_32.lib
shlwapi.lib
mpi_prime.obj
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Comm_rank" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Comm_size" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Finalize" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Init" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Reduce" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_MPI_Wtime" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_comm_world" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_op_max" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_op_sum" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_int" in Funktion "_main".
mpi_prime.exe : fatal error LNK1120: 10 nicht aufgelöste Externe
Microsoft (R) C/C++-Optimierungscompiler Version 17.00.61030 für x86
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
mpi_prime.c
Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:mpi_prime.exe
/LIBPATH:C:\Entwicklung\OpenMPI_v1.6.2-win32/lib
libmpi.lib
libopen-pal.lib
libopen-rte.lib
advapi32.lib
Ws2_32.lib
shlwapi.lib
mpi_prime.obj
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_comm_world" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_op_max" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_op_sum" in Funktion "_main".
mpi_prime.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ompi_mpi_int" in Funktion "_main".
mpi_prime.exe : fatal error LNK1120: 4 nicht aufgelöste Externe
EDIT : Verweis auf nicht aufgelöstes externes Symbol means of course "unresolved reference to external symbol"
So I guess it had something to do with a 32bit vs. 64bit library problem using the wrong .dll as the 32bit version seems to produce less conflicts.
My plan looks like:
get it running on 32bit -> here I'm right now
get it running on 64bit
get it running with another compiler, eg gcc
get it running with my IDE codeblocks
The binary Open MPI distribution for Windows ships with the library built as set of DLLs. The provided .lib files are simply import libraries for those DLLs. When calling functions from DLLs, their prototypes have to carry the __declspec(dllimport) extended storage-class attribute in order to allow the compiler to generate a slightly different code to call such functions or to access exported variables. Also functions with the dllimport storage-class attribute have their names prefixed with _imp_. Without dllimport, e.g. for MPI_Init, the compiler generates reference to the _MPI_Init symbol while the library actually exports _imp_MPI_Init, hence resulting in an unresolved symbol error.
Since Open MPI could be compiled either as a set of static libraries or as a set of DLLs, it uses a simple preprocessor mechanism to handle both cases with a single set of header files (e.g. mpi.h). If the preprocessor symbol OMPI_IMPORTS is defined, all MPI function prototypes get the dllimport treatment and do not get it otherwise. The same is true for the function prototypes from the ORTE and OPAL frameworks, with the corresponding preprocessor symbols being ORTE_IMPORTS and OPAL_IMPORTS.
To get your code to compile with the binary Open MPI distribution, you should add OMPI_IMPORTS to the list of preprocessor definitions, which could be found in the project's settings: Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions.
Related
I'm trying to use MSVC to compile a C program with the Flite text-to-speech library, but I'm getting unresolved external symbol errors.
I started with the "C Example" from the Flite docs but they use gcc. I was able to get rid of some errors by linking ws2_32.lib and legacy_stdio_definitions.lib but I can't find a solution to the remaining ones.
Do I just need to use a different compiler, or is there some solution that will allow me to use MSVC?
main.c
#include "flite.h"
register_cmu_us_kal();
int main(int argc, char **argv)
{
cst_voice *v;
if (argc != 2)
{
fprintf(stderr, "usage: flite_test FILE\n");
exit(-1);
}
flite_init();
v = register_cmu_us_kal(NULL);
flite_file_to_speech(argv[1], v, "play");
}
build.bat
cl ..\src\main.c -I "../lib/Flite/include/" /link ws2_32.lib legacy_stdio_definitions.lib /LIBPATH:"../lib/Flite/lib" libflite_cmu_us_kal.a libflite_usenglish.a libflite_cmulex.a libflite.a
Result
build.bat
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26128 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
..\src\main.c(17): warning C4047: '=': 'cst_voice *' differs in levels of indirection from 'int'
Microsoft (R) Incremental Linker Version 14.13.26128.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
ws2_32.lib
legacy_stdio_definitions.lib
/LIBPATH:../lib/Flite/lib
libflite_cmu_us_kal.a
libflite_usenglish.a
libflite_cmulex.a
libflite.a
main.obj
libflite_usenglish.a(us_expand.o) : error LNK2019: unresolved external symbol __locale_ctype_ptr referenced in function en_exp_letters
libflite.a(cst_string.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(regexp.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(cst_lexicon.o) : error LNK2019: unresolved external symbol __getreent referenced in function cst_lex_make_entry
libflite.a(cst_error.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_tokenstream.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol getpagesize referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol mmap referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol munmap referenced in function cst_munmap_file
libflite.a(au_oss.o) : error LNK2019: unresolved external symbol ioctl referenced in function audio_open_oss
main.exe : fatal error LNK1120: 6 unresolved externals
I'm trying to get familiar with Eiffel language so I've installed Eiffel Studio 18 and created a Graphics application. Compilation failed with message:
Preparing C compilation using already configured msc C compiler...
ERROR: Cannot start "nmake".ERROR: Cannot start "nmake".
Documentation suggested that espawn utility may show available toolchains, however it seems to crash:
PS C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\tools\spec\win64\bin> & "C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\tools\spec\win64\bin\espawn.exe" -l
Eiffel Environment Command Spawn Utility - Version: 18.07
Copyright Eiffel Software 1985-2018. All Rights Reserved.
Available C/C++ compilers:
espawn: system execution failed.
Following is the set of recorded exceptions:
******************************** Thread exception *****************************
In thread Root thread 0x0 (thread id)
*******************************************************************************
-------------------------------------------------------------------------------
Class / Object Routine Nature of exception Effect
-------------------------------------------------------------------------------
APPLICATION root's creation Segmentation violation:
<000000000363C588> Operating system signal. Exit
-------------------------------------------------------------------------------
APPLICATION root's creation
<000000000363C588> Routine failure. Exit
-------------------------------------------------------------------------------
Unfortunately I couldn't find any toolchain related stuff except for that espawn util so I've tried to launch Eiffel Studio from VS development command prompt hoping that it may implicitly rely on some environment variables. This indeed helped, however compilation still fails with linker error:
Preparing C compilation using already configured msc C compiler...
big_file_C28_c.c
eoption.c
big_file_E2_c.c
big_file_C26_c.c
big_file_C27_c.c
big_file_C30_c.c
big_file_C29_c.c
big_file_C31_c.c
eref.c
epoly.c
esize.c
big_file_C25_c.c
big_file_C24_c.c
big_file_C23_c.c
big_file_C22_c.c
big_file_C21_c.c
big_file_C20_c.c
big_file_C19_c.c
eplug.c
eskelet.c
enames.c
evisib.c
big_file_C18_c.c
big_file_C17_c.c
big_file_C16_c.c
big_file_C15_c.c
big_file_C13_c.c
big_file_C14_c.c
ececil.c
big_file_C12_c.c
einit.c
eparents.c
big_file_C11_c.c
big_file_C10_c.c
big_file_C9_c.c
big_file_C8_c.c
big_file_C7_c.c
big_file_C6_c.c
big_file_C5_c.c
big_file_C4_c.c
big_file_C3_c.c
big_file_C2_c.c
big_file_C1_c.c
Скопировано файлов: 1.
emain.c
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.16.27024.1
Copyright (C) Microsoft Corporation. All rights reserved.
-STACK:5000000 -NODEFAULTLIB:libc -STACK:5000000 -NODEFAULTLIB:libc -SUBSYSTEM:WINDOWS -OUT:my_wel_application_1.exe
e1\emain.obj
"C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\studio\spec\win64\lib\msc\finalized.lib" "C:\Program Files\Eiffel Software\EiffelStudio 18.07 GPL\library\wel\spec\msc\win64\lib\wel.lib"
USER32.lib WS2_32.lib ADVAPI32.lib GDI32.lib SHELL32.lib MSIMG32.lib COMDLG32.lib UUID.lib OLE32.lib OLEAUT32.lib COMCTL32.lib MPR.LIB SHLWAPI.LIB WINSPOOL.LIB
my_wel_application_1.res
E2\Eobj2.lib E1\eparents.obj E1\einit.obj E1\ececil.obj E1\evisib.obj
E1\enames.obj E1\eskelet.obj E1\eplug.obj E1\esize.obj E1\epoly.obj
E1\eref.obj E1\eoption.obj C31\Cobj31.lib C30\Cobj30.lib C29\Cobj29.lib
C28\Cobj28.lib C27\Cobj27.lib C26\Cobj26.lib C25\Cobj25.lib C24\Cobj24.lib
C23\Cobj23.lib C22\Cobj22.lib C21\Cobj21.lib C20\Cobj20.lib C19\Cobj19.lib
C18\Cobj18.lib C17\Cobj17.lib C16\Cobj16.lib C15\Cobj15.lib C14\Cobj14.lib
C13\Cobj13.lib C12\Cobj12.lib C11\Cobj11.lib C10\Cobj10.lib C9\Cobj9.lib
C8\Cobj8.lib C7\Cobj7.lib C6\Cobj6.lib C5\Cobj5.lib C4\Cobj4.lib
C3\Cobj3.lib C2\Cobj2.lib C1\Cobj1.lib
finalized.lib(econsole.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(console.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(file.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(main.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(except.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(sig.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(option.obj) : error LNK2001: unresolved external symbol __iob_func
finalized.lib(main.obj) : error LNK2019: unresolved external symbol _set_output_format referenced in function eif_rtinit
finalized.lib(run_idr.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(except.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(out.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(file.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(store.obj) : error LNK2001: unresolved external symbol sprintf
finalized.lib(econsole.obj) : error LNK2019: unresolved external symbol vfprintf referenced in function print_err_msg
finalized.lib(file.obj) : error LNK2019: unresolved external symbol fscanf referenced in function rt_swallow_nl
finalized.lib(retrieve.obj) : error LNK2019: unresolved external symbol sscanf referenced in function iread_header_new
finalized.lib(run_idr.obj) : error LNK2001: unresolved external symbol sscanf
my_wel_application_1.exe : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.EXE"' : return code '0x460'
Stop.
The compilation error when running from VS development command prompt is related to the mismatch between C compiler version and used Eiffel run-time library. Setting the corresponding environment variable before launching the compilation should fix the issue:
set ISE_C_COMPILER=msc_vc140
As to the original error, for some reason, C compilation fails on some machines, because EiffelStudio cannot find VS. The issue has even become a FAQ.
I'm converting a large Visual Studio solution from VS 2010 to VS 2017. One of the projects in the solution contains only C, no C++, and compiles with /MT to link statically with the multi-threaded C runtime.
Unfortunately, the C runtime functions don't seem to be getting found by the linker, even though libcmt.lib is in the list of libraries. The linker actually says that this lib is unused in the verbose output.
Why is the linker not finding the functions?
Output:
redacted.obj : error LNK2019: unresolved external symbol memcpy referenced in function FsConvertAndFreeInformation
redacted.obj : error LNK2019: unresolved external symbol memset referenced in function FsInitDebugSocket
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol memset
redacted.obj : error LNK2019: unresolved external symbol wcsstr referenced in function FsGetTokenInformation
redacted.obj : error LNK2019: unresolved external symbol wcscat_s referenced in function FsGetTokenInformation
redacted.obj : error LNK2019: unresolved external symbol wcsncpy_s referenced in function FsGetTokenInformation
redacted.obj : error LNK2019: unresolved external symbol _wcsdup referenced in function LsaApLogonUserEx2
redacted.obj : error LNK2019: unresolved external symbol wcscpy referenced in function SetUnicodeString
redacted.obj : error LNK2019: unresolved external symbol wcslen referenced in function FsDebugLog
redacted.obj : error LNK2019: unresolved external symbol _wcsicmp referenced in function LsaApLogonUserEx2
redacted.obj : error LNK2019: unresolved external symbol strlen referenced in function AnsiToUnicode
redacted.obj : error LNK2019: unresolved external symbol free referenced in function LsaApLogonUserEx2
redacted.obj : error LNK2019: unresolved external symbol mbstowcs referenced in function AnsiToUnicode
redacted.obj : error LNK2019: unresolved external symbol __stdio_common_vswprintf referenced in function _vsnwprintf_l
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol _initterm referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach##YAHQEAUHINSTANCE__##QEAX#Z)
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol _initterm_e referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach##YAHQEAUHINSTANCE__##QEAX#Z)
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(tncleanup.obj) : error LNK2019: unresolved external symbol __std_type_info_destroy_list referenced in function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info##YAXXZ)
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _seh_filter_dll referenced in function __scrt_dllmain_exception_filter
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _configure_narrow_argv referenced in function "public: static int __cdecl __scrt_narrow_argv_policy::configure_argv(void)" (?configure_argv#__scrt_narrow_argv_policy##SAHXZ)
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _initialize_narrow_environment referenced in function "public: static int __cdecl __scrt_narrow_environment_policy::initialize_environment(void)" (?initialize_environment#__scrt_narrow_environment_policy##SAHXZ)
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _initialize_onexit_table referenced in function __scrt_initialize_onexit_tables
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _register_onexit_function referenced in function _onexit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _execute_onexit_table referenced in function __scrt_dllmain_uninitialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _crt_atexit referenced in function _onexit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _crt_at_quick_exit referenced in function at_quick_exit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _cexit referenced in function __scrt_dllmain_uninitialize_c
msvcrt.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol terminate referenced in function __scrt_unhandled_exception_filter
Unused libraries:
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\odbc32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\odbccp32.lib
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\lib\x64\libcmt.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\user32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\gdi32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\winspool.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\comdlg32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\shell32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\ole32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\oleaut32.lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64\uuid.lib
Compiler command line options:
/FR"x64\ReleaseU\"
/GS
/W2
/Zc:wchar_t
/Zi
/Gm-
/Od
/Fd"x64\ReleaseU\vc141.pdb"
/Zc:inline
/fp:precise
/D "WIN32"
/D "NDEBUG"
/D "_WINDOWS"
/D "_MBCS"
/D "_USRDLL"
/D "SECURITY_WIN32"
/D "REDACTED_EXPORTS"
/D "UNICODE"
/D "_BIND_TO_CURRENT_VCLIBS_VERSION=1"
/D "_VC80_UPGRADE=0x0600"
/D "_WINDLL"
/D "_UNICODE"
/errorReport:prompt
/WX
/Zc:forScope
/Gd
/MT
/FC
/Fa"x64\ReleaseU\"
/EHsc
/nologo
/Fo"x64\ReleaseU\"
/Fp"x64\ReleaseU\redacted.pch"
/diagnostics:classic
Linker command line options:
/OUT:"C:\Devel\redacted\src\x64\ReleaseU\redacted.dll"
/MANIFEST
/PDB:"C:\Devel\redacted\src\pdbmap/x64/redacted.pdb"
/DYNAMICBASE:NO
"odbc32.lib" "odbccp32.lib" "netapi32.lib" "msvcrt.lib" "Ws2_32.lib" "authz.lib" "libcmt.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib"
/DEF:".\redacted.def"
/IMPLIB:"C:\Devel\redacted\src\x64\ReleaseU\redacted.lib"
/DEBUG
/DLL
/MACHINE:X64
/INCREMENTAL:NO
/PGD:"C:\Devel\redacted\src\x64\ReleaseU\redacted.pgd"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/ManifestFile:"x64\ReleaseU\redacted.dll.intermediate.manifest"
/MAP":C:\Devel\redacted\src\pdbmap/x64/redacted.map"
/ERRORREPORT:PROMPT
/NOLOGO
/VERBOSE
/NODEFAULTLIB
/TLBID:1
It turns out that these functions were moved in Visual C++ 2015 into vcruntime.lib and libucrt.lib.
Since this project has /NODEFAULTLIB, these two libs need to be added to the Additional Dependencies.
I tried to compile main.c from this project Emacs-FullScreen-Win32 by using visual studio developer command prompt but I get the following error:
main.c
Microsoft (R) Incremental Linker Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
main.obj : error LNK2019: unresolved external symbol __imp__ShowWindowAsync#8 re
ferenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__SetWindowPos#28 refe
renced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxW#16 refer
enced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__GetWindowLongW#8 ref
erenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongW#12 re
ferenced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__FindWindowW#8 refere
nced in function _WinMain#16
main.obj : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW#8
referenced in function _is_topmost_requested
main.exe : fatal error LNK1120: 7 unresolved externals
Those unresolved external problems are likely due to you not properly linking the libraries that those functions are from. In your project settings, go to project properties. Expand configuration properties, then expand linker. In the linker's input settings, you can specify libraries that the program requires in the "additional dependencies" option.
I'm trying to build VTK with VTK_WRAP_TCL=ON and VTK_USE_TK=ON but having following linker errors:
> Compiling...
vtkTkAppInit.cxx
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
Creating library D:\VTK\bin\bin\Debug\vtk.lib and object D:\VTK\bin\bin\Debug\vtk.exp
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tk_MainEx referenced in function _main
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_CreateInterp referenced in function _main
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2001: unresolved external symbol __imp__Tcl_CreateInterp
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_SetVar referenced in function _Tcl_AppInit
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2001: unresolved external symbol __imp__Tcl_SetVar
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_Eval referenced in function _Tcl_AppInit
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tk_Init referenced in function _Tcl_AppInit
vtkTkAppInit.obj : error LNK2019: unresolved external symbol __imp__Tcl_Init referenced in function _Tcl_AppInit
vtkCommonTCL.lib(vtkTclUtil.obj) : error LNK2019: unresolved external symbol __imp__Tcl_GetAssocData referenced in function "struct vtkTclInterpStruct * __cdecl vtkGetInterpStruct(struct Tcl_Interp *)" (?vtkGetInterpStruct##YAPAUvtkTclInterpStruct##PAUTcl_Interp###Z)
vtkFilteringTCL.lib(vtkSourceTcl.obj) : error LNK2019: unresolved external symbol __imp__Tcl_DeleteCommand referenced in function "int __cdecl vtkSourceCppCommand(class vtkSource *,struct Tcl_Interp *,int,char * * const)" (?vtkSourceCppCommand##YAHPAVvtkSource##PAUTcl_Interp##HQAPAD#Z)
vtkRenderingTCL.lib(vtkAbstractVolumeMapperTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkRenderingTCL.lib(vtkImporterTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkWidgetsTCL.lib(vtkContinuousValueWidgetRepresentationTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkProcessObjectTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkMapper2DTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkViewportTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkAbstractMapperTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkThreadedImageAlgorithmTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkImageInPlaceFilterTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
vtkFilteringTCL.lib(vtkRectilinearGridSourceTcl.obj) : error LNK2001: unresolved external symbol __imp__Tcl_DeleteCommand
.
.
D:\VTK\bin\bin\Debug\vtk.exe : fatal error LNK1120: 65 unresolved externals
Results
Build log was saved at "file://d:\VTK\bin\Wrapping\Tcl\vtk.dir\Debug\BuildLog.htm"
vtk - 22432 error(s), 0 warning(s)
Please help to solve.
Thanks.
I installed Tclx64 version and was trying to build it with 32 bit compiler.
Problem is solved by installing x86 version and compiled it with Debug|Win32.
http://public.kitware.com/pipermail/vtkusers/2011-September/118696.html this post helped me to understand the problem.