Visual studio 2010 CUDA 4.0 Linker errors - windows

Does any one know an easy way to fix the followoing errors:
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutComparefe referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutDeleteTimer referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutGetTimerValue referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutStopTimer referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutStartTimer referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutCreateTimer referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutReadFilei referenced in function main
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutReadFilef referenced in function "int __cdecl ReadFile(struct Matrix *,char *)" (?ReadFile##YAHPEAUMatrix##PEAD#Z)
1>matrixmul.cu.obj : error LNK2019: unresolved external symbol __imp_cutWriteFilef referenced in function "void __cdecl WriteFile(struct Matrix,char *)" (?WriteFile##YAXUMatrix##PEAD#Z)
I've already tried adding the lib directories in:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\lib\x64
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\CUDALibraries\common\lib\x64
Any help is apreciated

Those symbols look like functions from the "cutil" library which is included with the CUDA SDK, so you ought to make sure that Visual Studio is set up to link against cutil.lib.

Related

Redifining C/C++ entry point in Microsoft Visual Studio 2015

Here's the thing, guys:
I've got a trouble trying to make the entry point of my program not called main
Earlier, in Visual Studio 2012 that was pretty easy - I just used /ENTRY key of linker or the same setting of my project (Project->'project_name' properties...->Linker->Advanced->Entry Point) and it worked properly: say, I had a function like this:
int LetsRock
{
...
return 0;
}
And I needed, as described above, just set /ENTRY:LetsRock and it ran first.
But in Microsoft Visual Studio 2015 Enterprise Version 14.0.25123.00 Update 2 things turn out quite strange:
As soon as I redefine the entrypoint, compiler gives me the bunch of 11 errors (actually 10, 'cause 11th only says, that there are 10 errors):
Here they are, for those, who don't wanna open the picture:
1>------ Build started: Project: Tester, Configuration: Debug Win32 ------
1> Source.c
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol __CrtDbgReport referenced in function __CRT_RTC_INIT
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function __CRT_RTC_INITW
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol ___stdio_common_vsprintf_s referenced in function __vsprintf_s_l
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned int)" (?GetPdbDllPathFromFilePath##YAHPB_WPA_WI#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned int)" (?GetPdbDllPathFromFilePath##YAHPB_WPA_WI#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol _wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned int)" (?GetPdbDllPathFromFilePath##YAHPB_WPA_WI#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol ___vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPAUHINSTANCE__##XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol ___vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPAUHINSTANCE__##XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol ___vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPAUHINSTANCE__##XZ)
1>MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
1>C:\<path to my folder>\Tester\Debug\Tester.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It turns out even stranger - if I set entrypoint setting to main (of course, here I also rename my function in the source file), it still doesn't work. The same set of errors.
So, the question is:How do I properly redefine the entry point of C/C++ project in Visual Studio 2015?
If this is impossible, why haven't they, finally, removed this setting?
Ok, as Hans Passant advised, I just added more .lib dependencies: vcruntimed.lib and ucrtd.lib, and it worked fine. It is compiled in Release configuration without those libs, but in this way it may not wok correctly - In my case, the program
#include <stdio.h>
int LetsRock()
{
getchar();
return 0;
}
didn't run, saying error LNK2001: unresolved external symbol __imp__getchar

Unresolved externals with statically built ffmpeg on Windows

I built ffmpeg 1.2.1 as a static lib - x64, debug. And I tried to open one of my older projects that links against it. After modifying some changed APIs and similar in my source, it compiled fine, but I have major problems with linking.
EDITED: the complete latest build output:
1>libavformat.a(mov.o) : error LNK2019: unresolved external symbol __imp__gmtime64 referenced in function mov_read_mvhd
1>libavutil.a(parseutils.o) : error LNK2001: unresolved external symbol __imp__gmtime64
1>libavformat.a(os_support.o) : error LNK2019: unresolved external symbol __imp__wsopen referenced in function ff_win32_open
1>libavcodec.a(pthread.o) : error LNK2019: unresolved external symbol __imp__beginthreadex referenced in function ff_thread_init
1>libavcodec.a(frame_thread_encoder.o) : error LNK2001: unresolved external symbol __imp__beginthreadex
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__localtime64 referenced in function av_parse_time
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__time64 referenced in function av_parse_time
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__mktime64 referenced in function av_parse_time
1>libmingwex.a(lib64_libmingwex_a-mingw_output_format.o) : error LNK2019: unresolved external symbol __mingw_get_msvcrt_handle referenced in function __mingw_set_output_format
1>libmingwex.a(lib64_libmingwex_a-mingw_get_codepage.o) : error LNK2001: unresolved external symbol __mingw_get_msvcrt_handle
What am I doing wrong? What am I missing here?
Does ffmpeg even work today on Windows platform as a static lib, or it becomes less functional on Windows with each new version?
First 8 errors could be solved by manually inserting
#define _CRTIMP
in some files. This will prevent incorrect use of declspec(__dllimport). We are building a static lib, not a DLL, so it shouldn't be there. I also tried using --extra-cflags='-D_CRTIMP' while running configure before building ffmpeg, but it brakes the build totally. So, manual way is the only way.
The last 2 errors are total bitch:
libmingwex.a(lib64_libmingwex_a-mingw_output_format.o) : error LNK2019: unresolved external symbol __mingw_get_msvcrt_handle referenced in function __mingw_set_output_format
1>libmingwex.a(lib64_libmingwex_a-mingw_get_codepage.o) : error LNK2001: unresolved external symbol __mingw_get_msvcrt_handle
I found these symbols in libmingw32.a (if I remember correctly). But, when I link it, I have conflicts with LIBCMTD.lib. Removing the LIBCMTD.lib creates tons of unresolved externals.So, I would say that today we are not able to build ffmpeg as static x64 lib on Windows. It was in a way expected, because each new version was less Windows friendly.

unresolved externals SAP NetWeaver RFC SDK 7.1 client example Visual Studio 2010

I'm trying to compile the companyClient.c in a visual studio 2010 project, but even if i link properly to the lib sapnwrfc.lib i still get several unresolved externals:
Error 1 error LNK2019: unresolved external symbol _RfcCloseConnection#8 referenced in function _errorHandling C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 2 error LNK2019: unresolved external symbol _RfcSAPUCToUTF8#24 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 3 error LNK2019: unresolved external symbol _RfcDestroyFunction#8 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 4 error LNK2019: unresolved external symbol _RfcGetString#24 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 5 error LNK2019: unresolved external symbol _RfcGetStructure#16 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 6 error LNK2019: unresolved external symbol _RfcInvoke#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 7 error LNK2019: unresolved external symbol _RfcSetChars#20 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 8 error LNK2019: unresolved external symbol _RfcCreateFunction#8 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 9 error LNK2019: unresolved external symbol _RfcGetFunctionDesc#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 10 error LNK2019: unresolved external symbol _RfcOpenConnection#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 11 error LNK1120: 10 unresolved externals C:\Users\Attila\Desktop\SAP_NWR_RFC\Debug\SAP_NWR_RFC.exe SAP_NWR_RFC
Can you tell me pls if i'm missing anything here?
I followed the guide in the pdf documentation, and also i've read:
(http://help.sap.com/saphelp_nwpi71/helpdata/en/22/0430ba488911d189490000e829fbbd/frameset.htm)
/
NetWeaver RFC SDK/Programming with the NW RFC API/Working with the NW RFC SDK Files
I'd be grateful for any kind of help.
I had the same issue. Make sure you are compiling to the OS, not the chip. If the OS is 32-bit, use the 32 bit compile/link options found here, if the chip and OS are 64-bit, follow the instructions for the 64-bit entry:
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1056696

wxWidgets 2.9.4 built under Visual C++ Express 2010 gives unresolved external errors

I have been trying to upgrade to wxWidgets 2.9.4 over my old 2.8.12 and have run into problems. I compiled it without errors from the command line but when I try to use them in the program that worked just fine under the previous version I get unresolved externals. I cut it down to just a bare frame and TextCtrl object and it still does this (it's basically identical to one of the sample codes at the moment).
I tried the following commands to build the static libraries:
nmake -f makefile.vc SHARED=0 BUILD=release + nmake -f makefile.vc SHARED=0 BUILD=debug
nmake -f makefile.vc SHARED=0 MONOLITHIC=0 BUILD=release + nmake -f makefile.vc SHARED=0 MONOLITHIC=0 BUILD=debug
nmake -f makefile.vc SHARED=0 BUILD=release UNICODE=0 + nmake -f makefile.vc SHARED=0 BUILD=debug UNICODE=0
nmake -f makefile.vc SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=0 + nmake -f makefile.vc SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=0
Note that I tried using them with both the recommended unicode and no longer supported non-unicode (changed the project properties in Configuration Properties->General accordingly). Also, I used multi-threaded DLL /MD and /MDd linking as recommended by the wxWidgets manual.
Edit: Tried using \MT and \MTd as well, same effect.
From all of the above I get the same linker errors listed below when compiling my application. Please advise me what to do because I have ran out of ideas...
Additionally, as a final resort I built the whole thing using the converted MSVS project from the ../build/msw folder but it gave me the same results.
Debug compile
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxApp::Initialize(int &,unsigned short * *)" (?Initialize#wxApp##UAE_NAAHPAPAG#Z)
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsoleBase::OnAssertFailure(unsigned short const *,int,unsigned short const *,unsigned short const *,unsigned short const *)" (?OnAssertFailure#wxAppConsoleBase##UAEXPBGH000#Z)
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsoleBase::OnAssert(unsigned short const *,int,unsigned short const *,unsigned short const *)" (?OnAssert#wxAppConsoleBase##UAEXPBGH00#Z)
1>hworld.obj : error LNK2001: unresolved external symbol "unsigned short const * const wxEmptyString" (?wxEmptyString##3PBGB)
1>hworld.obj : error LNK2019: unresolved external symbol "private: static struct wxString::SubstrBufFromType<class wxScopedCharTypeBuffer<unsigned short> > __cdecl wxString::ConvertStr(char const *,unsigned int,class wxMBConv const &)" (?ConvertStr#wxString##CA?AU?$SubstrBufFromType#V?$wxScopedCharTypeBuffer#G###1#PBDIABVwxMBConv###Z) referenced in function "private: static class wxScopedCharTypeBuffer<unsigned short> __cdecl wxString::ImplStr(char const *,class wxMBConv const &)" (?ImplStr#wxString##CA?AV?$wxScopedCharTypeBuffer#G##PBDABVwxMBConv###Z)
1>hworld.obj : error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,unsigned short const *)" (?wxOnAssert##YAXPBDH00PBG#Z) referenced in function "public: void __thiscall wxControlContainerBase::SetContainerWindow(class wxWindow *)" (?SetContainerWindow#wxControlContainerBase##QAEXPAVwxWindow###Z)
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflateInit_ referenced in function _png_create_read_struct_2
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflate referenced in function _png_read_row
1>wxpngd.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflate
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function _png_read_destroy
1>wxpngd.lib(wxpng_png.obj) : error LNK2019: unresolved external symbol _crc32 referenced in function _png_reset_crc
1>wxpngd.lib(wxpng_png.obj) : error LNK2019: unresolved external symbol _inflateReset referenced in function _png_reset_zstream
1>wxpngd.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflateReset
1>wxpngd.lib(wxpng_pngwrite.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _png_write_flush
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflate
1>wxpngd.lib(wxpng_pngwrite.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function _png_write_destroy
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflateEnd
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function _png_zlib_claim
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2019: unresolved external symbol _deflateReset referenced in function _png_zlib_release
Release compile
1>wxpng.lib(wxpng_png.obj) : error LNK2001: unresolved external symbol _crc32
1>wxpng.lib(wxpng_png.obj) : error LNK2001: unresolved external symbol _inflateReset
1>wxpng.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflateReset
1>wxpng.lib(wxpng_pngread.obj) : error LNK2001: unresolved external symbol inflateInit
1>wxpng.lib(wxpng_pngread.obj) : error LNK2001: unresolved external symbol _inflate
1>wxpng.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflate
1>wxpng.lib(wxpng_pngread.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>wxpng.lib(wxpng_pngwrite.obj) : error LNK2001: unresolved external symbol _deflate
1>wxpng.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflate
1>wxpng.lib(wxpng_pngwrite.obj) : error LNK2001: unresolved external symbol _deflateEnd
1>wxpng.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflateEnd
1>wxpng.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol deflateInit2
1>wxpng.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflateReset
1>MSVCRT.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
All errors coming from libpng are due to not linking with wxzlib[d].lib, simply add it to the list of libraries in your project. Or use the recommended way to build wxWidgets projects with MSVC and use auto-linking by prepending -I$(WXWIN)/include/msvc to your compiler header files search path.
The rest of the errors (which you only get in debug build which is suspicious on its own) are due to a mismatch between ANSI and Unicode builds. I don't know which version do you use finally as you seem to have built all of them at one moment or the other but if you use the default build, then you need to have _UNICODE and/or UNICODE defined in your project options.
Finally, to avoid such build mismatches in the future, either do nmake -f makefile.vc clean or use different build directories by using unique COMPILER_PREFIX for each build in the future. This is really not rocket science, you just need to avoid confusing yourself by doing too many things at once. Good luck!
Go to your project's settings and change General -> Character Set property accordingly. If you compiled the wx libs with UNICODE=0 (however recommended value is 1) then you need to use Multi-Byte Character set. If compiled ith UNICODE=1 then set that property to Unicode
As for runtime libs, if you compiled with SHARED=0 then in your project settings you will need to use C++ -> Code Generation -> Runtime Libraries property with 'Multi-Threaded Debug' and 'Multi-Threaded' for Debug and Release build accordingly.
The easiest way is to build wxWidgets libs from Visual Studio (there is a build/msw folder which contains solution file for VS2010) and in your project set the same properties as wx libs projects have.
I had this problem as well. I solved it by changing the setting in:
C/C++ | Language | Treat WChar_t as built in type
to Yes.

VS2010 Unresolved External Symbol boost::asio::detail::winsock_init_base::throw_on_error when linking boost-system with a project using libtorrent

I'm trying to build a small command line BitTorrent client using Rasterbar's libtorrent, which depends on Boost. I've built both the Boost libraries and the libtorrent library using their respective directions, but when I try to build my project I get the following linking errors
1>------ Build started: Project: MiniBT, Configuration: Debug Win32 ------
1>MiniBT.obj : error LNK2019: unresolved external symbol "protected: static void __cdecl boost::asio::detail::winsock_init_base::throw_on_error(struct boost::asio::detail::winsock_init_base::data &)" (?throw_on_error#winsock_init_base#detail#asio#boost##KAXAAUdata#1234##Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" (??0?$winsock_init#$01$0A##detail#asio#boost##QAE#_N#Z)
1>MiniBT.obj : error LNK2019: unresolved external symbol "protected: static void __cdecl boost::asio::detail::winsock_init_base::startup(struct boost::asio::detail::winsock_init_base::data &,unsigned char,unsigned char)" (?startup#winsock_init_base#detail#asio#boost##KAXAAUdata#1234#EE#Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" (??0?$winsock_init#$01$0A##detail#asio#boost##QAE#_N#Z)
1>MiniBT.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::asio::error::get_misc_category(void)" (?get_misc_category#error#asio#boost##YAABVerror_category#system#3#XZ) referenced in function "void __cdecl boost::asio::error::`dynamic initializer for 'misc_category''(void)" (??__Emisc_category#error#asio#boost##YAXXZ)
1>MiniBT.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl boost::asio::detail::win_tss_ptr_create(void)" (?win_tss_ptr_create#detail#asio#boost##YAKXZ) referenced in function "public: __thiscall boost::asio::detail::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::win_iocp_io_service,unsigned char>::context>::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::win_iocp_io_service,unsigned char>::context>(void)" (??0?$win_tss_ptr#Vcontext#?$call_stack#Vwin_iocp_io_service#detail#asio#boost##E#detail#asio#boost###detail#asio#boost##QAE#XZ)
1>MiniBT.obj : error LNK2019: unresolved external symbol "protected: static void __cdecl boost::asio::detail::winsock_init_base::cleanup(struct boost::asio::detail::winsock_init_base::data &)" (?cleanup#winsock_init_base#detail#asio#boost##KAXAAUdata#1234##Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::~winsock_init<2,0>(void)" (??1?$winsock_init#$01$0A##detail#asio#boost##QAE#XZ)
It seems to indicate that the asio::detail namespace didn't get included in the boost-system library as it is only those 5 symbols that it seems to have a problem with and it is linking to the boost-system library just fine otherwise. I'm trying to build a 32-bit application on a 64-bit system, but everything I've checked seems to be correctly configured for this.
I know I'm missing something, but I can't seem to figure out what. Does anyone have any suggestions?
With BOOST_ASIO_SEPARATE_COMPILATION defined, in addition to #include "boost/asio/ssl/impl/src.hpp", you must also #include "boost/asio/impl/src.hpp" in one of your cpp files.

Resources