error LNK2019: unresolved external symbol
OS Vista 64 Bits
CPU AMD 955 four cores
Visual Studio 2008

How do I fix the "error LNK2019: unresolved external symbol"

Thank you in Advance


Build Log Build started: Project: cudaOpenMP, Configuration: Debug|x64
Command Lines Creating temporary file "d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\RSP00001040366052.rsp" with contents
[
/OUT:"../../bin/win64/Debug/cudaOpenMP.exe" /VERSION:1 /INCREMENTAL:NO /LIBPATH:"D:\CUDA\lib" /LIBPATH:"../../common/lib" /LIBPATH:"D:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\common\lib" /MANIFEST /MANIFESTFILE:"x64\Debug\cudaOpenMP.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"x64\Debug/cudaOpenMP.pdb" /SUBSYSTEM:CONSOLE /OPT:NOICF /DYNAMICBASE:NO /MACHINE:X64 cudart.lib cutil64D.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\x64\Debug\cudaOpenMP.cu.obj"
]
Creating command line "link.exe @"d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\RSP00001040366052.rsp" /NOLOGO /ERRORREPORT:PROMPT"
Output Window Linking...
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaThreadExit referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetLastError referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaFree referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaConfigureCall referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMemcpy referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMemset referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMalloc referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDevice referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetErrorString referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaSetDevice referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDeviceProperties referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDeviceCount referenced in function main
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaSetupArgument referenced in function __device_stub__Z17kernelAddConstantPii
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaRegisterFunction referenced in function __sti____cudaRegisterAll_45_tmpxft_00001714_00000000_6_cudaO
penMP_cpp1_ii_940c3a36
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaRegisterFatBinary referenced in function __sti____cudaRegisterAll_45_tmpxft_00001714_00000000_6_cudaO
penMP_cpp1_ii_940c3a36
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaUnregisterFatBinary referenced in function __cudaUnregisterBinaryUtil
cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaLaunch referenced in function "enum cudaError __cdecl cudaLaunch(char *)" (??$cudaLaunch@D@@YA?AW4cudaError@@PEAD@Z)
../../bin/win64/Debug/cudaOpenMP.exe : fatal error LNK1120: 17 unresolved externals
Results Build Time 0:00
Build log was saved at "file://d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\BuildLog.htm"
cudaOpenMP - 18 error(s), 0 warning(s)
OS Vista 64 Bits

CPU AMD 955 four cores

Visual Studio 2008



How do I fix the "error LNK2019: unresolved external symbol"



Thank you in Advance





Build Log Build started: Project: cudaOpenMP, Configuration: Debug|x64

Command Lines Creating temporary file "d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\RSP00001040366052.rsp" with contents

[

/OUT:"../../bin/win64/Debug/cudaOpenMP.exe" /VERSION:1 /INCREMENTAL:NO /LIBPATH:"D:\CUDA\lib" /LIBPATH:"../../common/lib" /LIBPATH:"D:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\common\lib" /MANIFEST /MANIFESTFILE:"x64\Debug\cudaOpenMP.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"x64\Debug/cudaOpenMP.pdb" /SUBSYSTEM:CONSOLE /OPT:NOICF /DYNAMICBASE:NO /MACHINE:X64 cudart.lib cutil64D.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib



".\x64\Debug\cudaOpenMP.cu.obj"

]

Creating command line "link.exe @"d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\RSP00001040366052.rsp" /NOLOGO /ERRORREPORT:PROMPT"

Output Window Linking...

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaThreadExit referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetLastError referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaFree referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaConfigureCall referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMemcpy referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMemset referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaMalloc referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDevice referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetErrorString referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaSetDevice referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDeviceProperties referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaGetDeviceCount referenced in function main

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaSetupArgument referenced in function __device_stub__Z17kernelAddConstantPii

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaRegisterFunction referenced in function __sti____cudaRegisterAll_45_tmpxft_00001714_00000000_6_cudaO

penMP_cpp1_ii_940c3a36

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaRegisterFatBinary referenced in function __sti____cudaRegisterAll_45_tmpxft_00001714_00000000_6_cudaO

penMP_cpp1_ii_940c3a36

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol __cudaUnregisterFatBinary referenced in function __cudaUnregisterBinaryUtil

cudaOpenMP.cu.obj : error LNK2019: unresolved external symbol cudaLaunch referenced in function "enum cudaError __cdecl cudaLaunch(char *)" (??$cudaLaunch@D@@YA?AW4cudaError@@PEAD@Z)

../../bin/win64/Debug/cudaOpenMP.exe : fatal error LNK1120: 17 unresolved externals

Results Build Time 0:00

Build log was saved at "file://d:\CUDA\Exercises\test_mp\NVIDIA CUDA SDK\projects\cudaOpenMP\x64\Debug\BuildLog.htm"

cudaOpenMP - 18 error(s), 0 warning(s)

#1
Posted 08/04/2009 08:11 PM   
Hi. I am running with the same problem. It is almost impossible to get all necessary settings correct within Visual Studio. I got this problem whan I replaced a version of cuda.rules with version 2.3 Cuda.Rules and tried to rebuild necessary dependencies for CUDA-project. It is most probably a missing path or other setup alike somewhere. If you success to fing the correct place and parameter, please let us know!

I wonder what kind of dimmed-vision nerds there are in NVIDIA cuda labs as they are not able to publish a straight forward cookbook how to set up the VS environment in each revision of CUDA. I have been strugling endlessly with incorrect setups found from this same forum, weird indications like "invalid device function" etc. which all turned out to be a consequence of improper parameters and build rules. Finding the reason was just pure luck on fourth week of frustrating testing. No good. Conclusion: if you start using CUDA with Visual Studio, you will need several weeks to learn all necessary tricks and setups with the environment, not related to coding CUDA at all. Considering other solutions is really sensible. /thumbsdown.gif' class='bbc_emoticon' alt=':thumbsdown:' />
Hi. I am running with the same problem. It is almost impossible to get all necessary settings correct within Visual Studio. I got this problem whan I replaced a version of cuda.rules with version 2.3 Cuda.Rules and tried to rebuild necessary dependencies for CUDA-project. It is most probably a missing path or other setup alike somewhere. If you success to fing the correct place and parameter, please let us know!



I wonder what kind of dimmed-vision nerds there are in NVIDIA cuda labs as they are not able to publish a straight forward cookbook how to set up the VS environment in each revision of CUDA. I have been strugling endlessly with incorrect setups found from this same forum, weird indications like "invalid device function" etc. which all turned out to be a consequence of improper parameters and build rules. Finding the reason was just pure luck on fourth week of frustrating testing. No good. Conclusion: if you start using CUDA with Visual Studio, you will need several weeks to learn all necessary tricks and setups with the environment, not related to coding CUDA at all. Considering other solutions is really sensible. /thumbsdown.gif' class='bbc_emoticon' alt=':thumbsdown:' />

#2
Posted 09/24/2009 09:29 AM   
I'm also having a similar problem. To be honest I think you're being a bit harsh on CUDA though, if it were an MS product it'd probably be really east to use with VS. I'm having to use VS because of where I work and getting it to work is a pain. Usually I work under Linux and I can tell you that everything CUDA just works, right out the box..


[quote name='TimoS' post='591583' date='Sep 24 2009, 11:29 AM']Hi. I am running with the same problem. It is almost impossible to get all necessary settings correct within Visual Studio. I got this problem whan I replaced a version of cuda.rules with version 2.3 Cuda.Rules and tried to rebuild necessary dependencies for CUDA-project. It is most probably a missing path or other setup alike somewhere. If you success to fing the correct place and parameter, please let us know!

I wonder what kind of dimmed-vision nerds there are in NVIDIA cuda labs as they are not able to publish a straight forward cookbook how to set up the VS environment in each revision of CUDA. I have been strugling endlessly with incorrect setups found from this same forum, weird indications like "invalid device function" etc. which all turned out to be a consequence of improper parameters and build rules. Finding the reason was just pure luck on fourth week of frustrating testing. No good. Conclusion: if you start using CUDA with Visual Studio, you will need several weeks to learn all necessary tricks and setups with the environment, not related to coding CUDA at all. Considering other solutions is really sensible. /thumbsdown.gif' class='bbc_emoticon' alt=':thumbsdown:' />[/quote]
I'm also having a similar problem. To be honest I think you're being a bit harsh on CUDA though, if it were an MS product it'd probably be really east to use with VS. I'm having to use VS because of where I work and getting it to work is a pain. Usually I work under Linux and I can tell you that everything CUDA just works, right out the box..





[quote name='TimoS' post='591583' date='Sep 24 2009, 11:29 AM']Hi. I am running with the same problem. It is almost impossible to get all necessary settings correct within Visual Studio. I got this problem whan I replaced a version of cuda.rules with version 2.3 Cuda.Rules and tried to rebuild necessary dependencies for CUDA-project. It is most probably a missing path or other setup alike somewhere. If you success to fing the correct place and parameter, please let us know!



I wonder what kind of dimmed-vision nerds there are in NVIDIA cuda labs as they are not able to publish a straight forward cookbook how to set up the VS environment in each revision of CUDA. I have been strugling endlessly with incorrect setups found from this same forum, weird indications like "invalid device function" etc. which all turned out to be a consequence of improper parameters and build rules. Finding the reason was just pure luck on fourth week of frustrating testing. No good. Conclusion: if you start using CUDA with Visual Studio, you will need several weeks to learn all necessary tricks and setups with the environment, not related to coding CUDA at all. Considering other solutions is really sensible. /thumbsdown.gif' class='bbc_emoticon' alt=':thumbsdown:' />

#3
Posted 09/29/2009 01:11 PM   
OK, I finally solved this. It was very simple in the end...

My app was [b]not linking to cudart.lib[/b], the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.

Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)
OK, I finally solved this. It was very simple in the end...



My app was not linking to cudart.lib, the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.



Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)

#4
Posted 11/12/2009 05:25 PM   
[quote name='timmiroon' post='949983' date='Nov 13 2009, 01:25 AM']OK, I finally solved this. It was very simple in the end...

My app was [b]not linking to cudart.lib[/b], the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.

Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)[/quote]

I have a similar problem as follows:

错误 2 error LNK2019: 无法解析的外部符号 "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z),该符号在函数 "public: __thiscall std::_Locinfo::_Locinfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) 中被引用 shrUtils32D.lib

错误 3 error LNK2001: 无法解析的外部符号 "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) shrUtils32D.lib

错误 4 fatal error LNK1120: 1 个无法解析的外部命令 ../../bin/win32/EmuDebug/deviceQuery.exe

I try to add "cudart.lib" to the project, and I found other libs like "cudartemu.lib cutil32D.lib shrUtils32D.lib" is already included. Then the problem still happen. I think the problem is derived from "shrUtils32D.lib", but I don't know how to solve. :"> please take some suggestions, thank you very much.
[quote name='timmiroon' post='949983' date='Nov 13 2009, 01:25 AM']OK, I finally solved this. It was very simple in the end...



My app was not linking to cudart.lib, the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.



Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)



I have a similar problem as follows:



错误 2 error LNK2019: 无法解析的外部符号 "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z),该符号在函数 "public: __thiscall std::_Locinfo::_Locinfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) 中被引用 shrUtils32D.lib



错误 3 error LNK2001: 无法解析的外部符号 "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) shrUtils32D.lib



错误 4 fatal error LNK1120: 1 个无法解析的外部命令 ../../bin/win32/EmuDebug/deviceQuery.exe



I try to add "cudart.lib" to the project, and I found other libs like "cudartemu.lib cutil32D.lib shrUtils32D.lib" is already included. Then the problem still happen. I think the problem is derived from "shrUtils32D.lib", but I don't know how to solve. :"> please take some suggestions, thank you very much.

#5
Posted 01/21/2010 07:52 AM   
To Jason and all others having compiler issues with Visual Studio:
As a newb, I experienced these issues too. I found a wizard that sets up stuff correctly for using CUDA in Visual Studio.

It works great for me, and lets me focus on writing code, rather than bother with setting up the environment. You can download the wizard here:
[url="http://sourceforge.net/projects/cudavswizard/files/"]http://sourceforge.net/projects/cudavswizard/files/[/url]

There is also a forum thread on this wizard:
[url="http://forums.nvidia.com/index.php?showtopic=83054"]http://forums.nvidia.com/index.php?showtopic=83054[/url]
To Jason and all others having compiler issues with Visual Studio:

As a newb, I experienced these issues too. I found a wizard that sets up stuff correctly for using CUDA in Visual Studio.



It works great for me, and lets me focus on writing code, rather than bother with setting up the environment. You can download the wizard here:

http://sourceforge.net/projects/cudavswizard/files/



There is also a forum thread on this wizard:

http://forums.nvidia.com/index.php?showtopic=83054

#6
Posted 01/23/2010 10:12 PM   
[quote name='Moiz Ahmad' post='987338' date='Jan 24 2010, 06:12 AM']To Jason and all others having compiler issues with Visual Studio:
As a newb, I experienced these issues too. I found a wizard that sets up stuff correctly for using CUDA in Visual Studio.

It works great for me, and lets me focus on writing code, rather than bother with setting up the environment. You can download the wizard here:
[url="http://sourceforge.net/projects/cudavswizard/files/"]http://sourceforge.net/projects/cudavswizard/files/[/url]

There is also a forum thread on this wizard:
[url="http://forums.nvidia.com/index.php?showtopic=83054"]http://forums.nvidia.com/index.php?showtopic=83054[/url][/quote]

Thank you very much^^, that's an easy way to do it. :rolleyes:
[quote name='Moiz Ahmad' post='987338' date='Jan 24 2010, 06:12 AM']To Jason and all others having compiler issues with Visual Studio:

As a newb, I experienced these issues too. I found a wizard that sets up stuff correctly for using CUDA in Visual Studio.



It works great for me, and lets me focus on writing code, rather than bother with setting up the environment. You can download the wizard here:

http://sourceforge.net/projects/cudavswizard/files/



There is also a forum thread on this wizard:

http://forums.nvidia.com/index.php?showtopic=83054



Thank you very much^^, that's an easy way to do it. :rolleyes:

#7
Posted 03/10/2010 08:41 AM   
I had this happen to me on vista 64. Install the win32 cuda toolkit and the linking problem goes away.
I had this happen to me on vista 64. Install the win32 cuda toolkit and the linking problem goes away.

#8
Posted 10/01/2010 07:44 PM   
I had this happen to me on vista 64. Install the win32 cuda toolkit and the linking problem goes away.
I had this happen to me on vista 64. Install the win32 cuda toolkit and the linking problem goes away.

#9
Posted 10/01/2010 07:44 PM   
[quote name='timmiroon' date='12 November 2009 - 05:25 PM' timestamp='1258046702' post='949983']
OK, I finally solved this. It was very simple in the end...

My app was [b]not linking to cudart.lib[/b], the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.

Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)
[/quote]


What do you mean by "start up" project. How is it different from your normal project? I really need help with this. Can you let me know where the startup project is located in VS and how to configure it.
[quote name='timmiroon' date='12 November 2009 - 05:25 PM' timestamp='1258046702' post='949983']

OK, I finally solved this. It was very simple in the end...



My app was not linking to cudart.lib, the CUDA runtime library. I added cudart.lib to my additional libraries in my "start-up" project, which is not my CUDA project, and now it works.



Simple really. Why doesn't the build rule do this automatically. It's such a minor thing yet it causes a lot of problems as far as I can tell. This thread is just one of many I've come accross on the subject. Now it's one of the first to have a solution :)







What do you mean by "start up" project. How is it different from your normal project? I really need help with this. Can you let me know where the startup project is located in VS and how to configure it.

#10
Posted 07/01/2011 04:44 PM   
[quote name='thesolver' date='01 July 2011 - 09:44 AM' timestamp='1309538655' post='1258872']
What do you mean by "start up" project. How is it different from your normal project? I really need help with this. Can you let me know where the startup project is located in VS and how to configure it.
[/quote]

This thread is a year old but I had this same issue, and its real frustrating finding a thread unfinished, so I will finish it. I found that by putting cudart.lib in the additional dependencies solved the problem. Additional dependencies can be found: project properties >> Linker >> input.
[quote name='thesolver' date='01 July 2011 - 09:44 AM' timestamp='1309538655' post='1258872']

What do you mean by "start up" project. How is it different from your normal project? I really need help with this. Can you let me know where the startup project is located in VS and how to configure it.





This thread is a year old but I had this same issue, and its real frustrating finding a thread unfinished, so I will finish it. I found that by putting cudart.lib in the additional dependencies solved the problem. Additional dependencies can be found: project properties >> Linker >> input.

#11
Posted 04/23/2012 04:28 AM   
@Pearlmam, I had the same issue, and you made the resolution easy after reading through all the posts here, guess I should have started at the bottom
@Pearlmam, I had the same issue, and you made the resolution easy after reading through all the posts here, guess I should have started at the bottom

#12
Posted 07/02/2013 07:33 PM   
Scroll To Top