MaFonction.cu.obj : error LNK2019: symbole externe non résolu __imp_ldexp référ

Bonjour,

Je recompil mon appli en 64 Bits (j’a basculé sur le Bib 64 bits): tous se passe bien sauf que j’ai le message, pour 2 sources en *.cu:
MaFonction1.cu.obj : error LNK2019: symbole externe non résolu __imp_ldexp référencé dans la fonction scalbn
MaFonction2.cu.obj : error LNK2019: symbole externe non résolu __imp_ldexp référencé dans la fonction scalbn

Qu’est ce qu’il manque ? qu’est ce que cette fonction ldexp ?
Merci

Sorry, I don’t speak French, so I will reply in English.

ldexp() and scalbn() are standard C/C++ math library functions (and from the error message it seems that the implementation scalbn() uses ldexp() internally). I suspect (but cannot tell for sure) that the problem is in the host code, as I am not aware of a __imp_ldexp() function in a CUDA context. My best guess is that you are building on 64-bit Windows and some required MSVC library is not being linked in.

(1) Does this happen with CUDA 5.5, or are you using an earlier version ?
(2) Are you using separate compilation of device code ?
(3) What is the smallest program that reproduces the issue (please show the complete code and nvcc commandline(s) used to build it) ?

[later:]

An internet search seems to indicate that “__imp_ldexp” is a symbol in the MSVC runtime, so the problem at hand would appear to be an issue with linking of host code. I would suggest checking that MSVC is correctly installed and fully operable and you are able to build non-CUDA programs from the command line with ‘cl’.

Hy,

Thanks for your answer.
Exactly, Its seem to be a symbol in the MSVC runtime, witch has been forgoten.

I use CUDA V 4.2 64 bits, and I am building on 64 bits Windows seven with Visual Studio 2010.
The buiding on 32 bits works perfectly for this programm.
I have cheked that the MSVC is ccorrectly installed.
I have change the path to the library 64 bits to built it.
The cuda command line generated is:

(Approximate command-line, please see the output window after a build for the full command-line)

Driver API (NVCC Compilation Type is .cubin, .gpu, or .ptx)

set CUDAFE_FLAGS=–sdk_dir “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A"
“D:\Mes docs\F - DVD 6 - Prog et 3D\VII - Sources C++\NVIDIA\NVIDIA GPU Computing Toolkit\CUDA\v4.2 64 bits\bin\nvcc.exe” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I”…\Bibliotheques Communes V 4-2\common\inc" -G --keep-dir “x64\Debug” -maxrregcount=0 --machine 64 --compile -o “x64\Debug%(Filename)%(Extension).obj” “%(FullPath)”

Runtime API (NVCC Compilation Type is hybrid object or .c file)

set CUDAFE_FLAGS=–sdk_dir “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A"
“D:\Mes docs\F - DVD 6 - Prog et 3D\VII - Sources C++\NVIDIA\NVIDIA GPU Computing Toolkit\CUDA\v4.2 64 bits\bin\nvcc.exe” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I”…\Bibliotheques Communes V 4-2\common\inc" -G --keep-dir “x64\Debug” -maxrregcount=0 --machine 64 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o “x64\Debug%(Filename)%(Extension).obj” “%(FullPath)”

How I can do, I can’t change the original code frome de library…

Thanks for your help

My best guess is that something is still pointing at a 32-bit location where it should be pointing at the 64-bit location, or that some locations relevant to 64-bit builds are missing. Are you able to successfully build (using the command line compiler ‘cl’) a 64-bit Windows command line app that uses scalbn()?

I tried a simple CUDA program that uses scalbn() in the host portion of the .cu file on a Win64 machine with MSVS 10.0 and it built and ran fine. This would suggest the trouble maybe local to your setup.

Hy,

You have put me on the good way to find what occur the compilling error and I hae found the error:

I have test to go to source file with rigth clic on the #include … for cuda program and I discover that some of thems are in the directory of the 4.2 version, and other in the 5.0, the 4.1.

So I replace all the setup of the project, for cuda, witch use macro (for exemple $(CUDA_PATH) ) by the direct path “c:.…”.

I think it’s because I have installed all the vesions, in my own directory. Thus, the macro don’t be correcly set.

Thanks a lot for your helps

Hy,
I Have fond the solution:
IHaven’t correctly send the 32 or 64 Bits in the configuration manager:
32 bit for 32 application and 6 bits for 64 bits application
This error occure the message (if you put 64 bits for a 32 or 32 bits for a 64 bits application):
“error LNK2019: symbole externe non résolu __imp_ldexp référencé dans la fonction scalbn”

Bonjour,
L’Erreur venait du fait que je n’avais pas correctement mis dans le gestionnaire de configuration les bon nombre d bit pour les versions 32 bits et 64 bits.

Thank’s for your responses. They help me a lot to found the errors.

Merci pour vos réponses, elles m’ont mises sur la piste des erreurs.