LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building DLL error with vc++ 6.0:error LNK2001: unresolved external symbol __imp__MessageBoxA@16

Solved!
Go to solution

Hi everyone.

I just follow the example below

http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/concatenating_two_strings/

but vc allways give me an error like that:

 

--------------------Configuration: MyDLLTest - Win32 Debug--------------------
Compiling...
MyDLLTest.cpp
Linking...
   Creating library Debug/MyDLLTest.lib and object Debug/MyDLLTest.exp
labviewv.lib(lvlvrt.obj) : error LNK2001: unresolved external symbol
__imp__MessageBoxA@16
Debug/MyDLLTest.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...

MyDLLTest.dll - 2 error(s), 0 warning(s)

 

I'm sure that I have include the labview.lib file or labviewv.lib,because the manual says labview 8.0 or new version should include labviewv.lib rather than labview.lib.

And I also tried to insert extern "c" before the declaration of the function.It doesn't work.

What's wrong with that ?

帖子被chenyin在 01-14-2010 11:22 PM
时编辑过了
帖子被chenyin在 01-14-2010 11:27 PM
时编辑过了
0 Kudos
Message 1 of 10
(10,428 Views)

the version of LabVIEW I used is 2009

0 Kudos
Message 2 of 10
(10,421 Views)

Something new......

if I include the user32.lib,the error above will go away

but another error comes out:

 

--------------------Configuration: MyDLLTest - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
MyDLLTest.cpp
Linking...
   Creating library Debug/MyDLLTest.lib and object Debug/MyDLLTest.exp
LINK : fatal error LNK1000: unknown error; consult documentation for technical support options
Error executing link.exe.
Creating browse info file...

MyDLLTest.dll - 1 error(s), 0 warning(s)

 

sigh

and which use32.lib should I choose ?

there are 4 use32.lib files in my disk......

look at the jpeg

thank you

帖子被chenyin在 01-14-2010 11:56 PM
时编辑过了
0 Kudos
Message 3 of 10
(10,419 Views)

MessageBox() is a Windows API. It is contained in user32.dll (not use32.dll). user32.lib is the import library that can locate functions in user32.dll and this import library should be added to the link settings.

 

For import libraries that come with Visual Studio or the Mocrosoft Platform SDKs you usually do not include a specific library file but instead the according name to the link settings. Visual Studio has its own default paths where it will look for such libraries and just adding user32.lib to the link settings will make sure that Visual studio is told to look for that file in the locations it has setup to look for link libraries.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 10
(10,404 Views)

thanks rolfk

So,I have succeeded to include the user32.lib (it is in the vc++ directory)

but the still have an error which I can't fixed.


--------------------Configuration: MyDLLTest - Win32 Debug--------------------
Linking...
   Creating library Debug/MyDLLTest.lib and object Debug/MyDLLTest.exp
LINK : fatal error LNK1000: unknown error; consult documentation for technical support options
Error executing link.exe.

MyDLLTest.dll - 1 error(s), 0 warning(s)

 

what should I do?

waiting for your reply

0 Kudos
Message 5 of 10
(10,392 Views)

the xample is better than the explaination.

So, could you please upload a vc++6.0 project example which includes the  NumericArrayResize function and pass the vc++ 6.0 compile?

Thank you very much.

I have been trouble with it for 2 days......help me

帖子被chenyin在 01-15-2010 08:07 AM
时编辑过了
0 Kudos
Message 6 of 10
(10,381 Views)

chenyin wrote:

the xample is better than the explaination.

So, could you please upload a vc++6.0 project example which includes the  NumericArrayResize function and pass the vc++ 6.0 compile?

Thank you very much.

I have been trouble with it for 2 days......help me

帖子被chenyin在 01-15-2010 08:07 AM
时编辑过了

Your previous error is completely bogus without more information. As the error message indicates:

 

LINK : fatal error LNK1000: unknown error; consult documentation for technical support options

 

This gives us completely zero onformation to even start to guess what might be the problem. At least providing the example that you try to compile with all VC and LabVIEW files as a ZIP archive is the absolute minimum that is required before anyone can even start to guess what your problem might be.

 

As to examples for NumericArrayResize. There are countless such examples on the NI site and even in the LabVIEW examples under examples\cins\lstrcat is one of them. Yes it is a CIN example which is in fact obsolete now, but the principle of the function call and the access to the Handle data afterwards is exactly the same independant if you use it in a DLL or a CIN.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 10
(10,373 Views)

thanks , sorry for the lack of the zip

How to use the DLL in LabVIEW has been clarified for me.What I can not fix is how to use the NumericArrayResize function and pass the vc++6.0 compile correctly.

there is the vc++6.0 project.

 

0 Kudos
Message 8 of 10
(10,357 Views)
Solution
Accepted by topic author chenyin

Your labviewv.lib file seems most likely to be corrupt.

 

When I take your project and remove the reference to labviewv.lib and instead edit the project settings to use labviewv.lib in the link settings and toinclude my path to C:\Program Files\National Instruments\LabVIEW 8.6\cintools as additional link directory everything works fine.

 

Also your labviewv.lib is 1.7 MB large, mine from LabVIEW 8.0 to 8.6 are all around 450kB.

 

If this is a legit link file from LabVIEW 2009 it may have been created with a Visual C version and/or options that make it incompatible with VC 6. Consider that VC 6 is about 10 years old.

Rolf Kalbermatter
My Blog
Message 9 of 10
(10,335 Views)

I really do not know what to say !!!

thank you very much !!!

 

I use the labviewv.lib of 8.2's instead of 2009's.It works!!!

greatly thanks

I can`t thank you enough!!!

0 Kudos
Message 10 of 10
(10,329 Views)