compiling dll in 2005 -- dll produced, but no lib
-
Wednesday, December 03, 2008 5:43 PMHi,
I am compiling a dll in vs2005 (C++/C) and while the .dll file is created, there is no .lib file created. What am I doing wrong and how do I get this library created -- otherwise I can't link :)
Sorry for this probably VERY basic question, but anyway...
Thanks,
Jeff
All Replies
-
Wednesday, December 03, 2008 6:19 PMCan you give a log file of you compilation process?
-
Wednesday, December 03, 2008 6:30 PMHere it is -- it is building C files.
1>------ Build started: Project: -DLL, Configuration: Debug Win32 ------1>Compiling...
1>stdafx.cpp
1>Compiling...
1>utils.c
1>c:\devtool\-dll\utils.c(330) : warning C4996: 'fopen' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1> Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(338) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(343) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(346) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\edofsamsung3_2_2dll\utils.c(375) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(376) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(386) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(388) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(390) : warning C4996: 'fscanf' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>c:\devtool\-dll\utils.c(1065) : warning C4996: 'fopen' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1> Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>calc.c
1>de.c
1>e.c
1>c:\devtool\-dll\e.c(157) : warning C4133: '=' : incompatible types - from '*__w64 ' to '*'
1>c:\devtool\-dll\e.c(166) : warning C4133: '=' : incompatible types - from '*__w64 ' to '*'
1>c:\devtool\-dll\e.c(175) : warning C4133: '=' : incompatible types - from '*__w64 ' to '*'
1>c:\devtool\-dll\e.c(184) : warning C4133: '=' : incompatible types - from '*__w64 ' to '*'
1>c:\devtool\-dll\e.c(248) : warning C4047: 'function' : 'short (*)[9]' differs in levels of indirection from 'short **'
1>c:\devtool\-dll\e.c(248) : warning C4024: 'calc_distances' : different types for formal and actual parameter 1
1>c:\devtool\-dll\e.c(248) : warning C4047: 'function' : 'int (*)[9]' differs in levels of indirection from 'int **'
1>c:\devtool\-dll\e.c(248) : warning C4024: 'calc_distances' : different types for formal and actual parameter 3
1>eds.c
1>pe.c
1>perfc
1>RunnerMain.c
1>Generating Code...
1>Compiling manifest to resources...
1>Linking...
1>LINK : C:\DevTool\Runner\Debug\-DLL.dll not found or not built by the last incremental link; performing full link
1>Embedding manifest...
1>Build log was saved at "file://c:\DevTool\-DLL\Debug\BuildLog.htm"
1>-DLL - 0 error(s), 18 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
-
Wednesday, December 03, 2008 6:31 PMAlso -- i changed the names of things to protect the code. I called the dll "-dll" and all the .c files got short names just to hide the names.
Sorry if this was confusing.... -
Wednesday, December 03, 2008 6:55 PMThan your .lib file should be in c:\DevTool\-DLL\Debug folder. Or you change some project properties?
-
Wednesday, December 03, 2008 7:18 PMI know it should.
It's not making one.
In fact if you look at the linker command line:
/OUT:"C:\DevTool\Runner\Debug\DLL.dll" /INCREMENTAL /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"Debug\DLL.dll.intermediate.manifest" /DEBUG /PDB:"c:\DevTool\Runner\Debug\DLL.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
There's no sign of the lib.
Although there is: Import Library: $(TargetDir)$(TargetName).lib in the advanced section.
I am not sure if this is because of precompiled headers that I only use in stdafx.cpp, or if it is because it is C code or if it is because I used an "Empty" project and not the fancy one with an entry point....
What do you think? -
Wednesday, December 03, 2008 7:24 PMThere souldn't be sign of lib. What is the value of TargetDir and TargetName macro?
-
Wednesday, December 03, 2008 8:11 PMGood news and Bad news:
When I define the thing like this:
extern
EDLL_API int Function(char* params_file,....)
where the EDLL_API is the __declspec(dllexport) in this case, I DO GET A LIB !!
Error 1 error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl Function(char *,short,short,int,short,short,short,short,unsigned short *,unsigned short *,int,int,void (__cdecl*)(int))" (__imp_?Function@@YAHPADFFHFFFFPAG1HHP6AXH@Z@Z) algorithms.lib
However, I call this from a static lib (Algorithms.lib) and the whole application is now still saying that
So this is better, but what the ... do I need to do to get this to be resolved? Do I need to do something in the main app (exe) or in algorithms.lib or in the new linked lib?
Jeff -
Wednesday, December 03, 2008 8:25 PMUse 'extern "C"' instead of just extern.
-
Wednesday, December 03, 2008 8:35 PMThen I get an error compiling --
error C2059: syntax error : 'string'
then the lib is not created...
Then if I surround it with #ifdef __cplusplusLINK : fatal error LNK1181: cannot open input file '.\release\dll.lib'
This is how it all started
So I am stuck. If I use the "C" and surround with the __cplusplus, I don't get the lib. If I just do extern, and no __cplusplus, the lib is created but I get the linker error. -
Wednesday, December 03, 2008 8:41 PM
#ifdef __cplusplus
extern "C"
#else
extern
#endif
EDLL_API int Function(char* params_file, ...);
- Marked As Answer by CPPPerson Wednesday, December 03, 2008 8:59 PM
-
Wednesday, December 03, 2008 9:00 PMBINGO :)
Thanks (I was so tired I didn't think of that one -- I tried to separate it into both files and this caused troubles)
I really appreciate this...

