gerol80
February 4th, 2009, 06:17 AM
Hello,
I have same problems with libraries in Visual C++ 2005.
We're developing a C++ application for an embedded device in Visual Studio 2005. This application is pure standard C++ (i.e. unmanaged, no Microsoft extensions, no Windows CE or similar on the device). These application consists of several VS projects, each of them compiled into a static lib. We also added a Win32 application, that can be used to run the embedded application on a Windows PC -- some kind of "simulator" for the embedded device.
As we load a binary configuration file into the embedded device I added a managed Windows Forms application to the solution, that can create such binary configuration files. This application uses some of the unmanaged libs (to access some structs and to use some basic methods, e.g. checksum calculation). It was no problem to use the unmanaged libs in the managed Windows Forms application.
Then we got the requirement that it must be possible to create the configuration files automatically from a command line. So I decided to split up the Windows Forms project into an application project, that only contains the GUI, and a library project, that does the actual conversion work -- and to add a second application project, that contains a command line tool. And here we have the problem: I don't get things working with this library.
I tried putting my "conversion worker" classes into a (managed) static lib, that links the (unmanaged) static libs from the embedded application. This works, I get a .lib file. But if I try to add the library project in the "References..." dialog, I get the error:
fatal error C1113: #using failed on 'xxx\myConversionWorker.lib'
If I remove the reference and try adding the lib file as an additional dependency instead, I get hundreds of "error LNK2020: unresolved token" messages (all referring to managed functions in the xxx\myConversionWorker.lib).
Then I tried to use a dynamic dll instead of a static lib. Then I get a lot of other errors when building the dll, e.g.
error C2011: 'namespace::classname' : 'class' type redefinition
error C2027: use of undefined type 'namespace::classname' (with the same 'namespace::classname' as the C2011!!)
error C2275: 'System::IO::FileInfo' : illegal use of this type as an expression
error C2275: 'System::String' : illegal use of this type as an expression
as well as lots of
error C2065: 'variableName' : undeclared identifier
and so on.
How do I get this to work? What I want to do, in short:
Create a managed application (Windows Forms or command line), that uses a managed library (lib or dll), which itself uses unmanaged static libs.
Thanks a lot!
I have same problems with libraries in Visual C++ 2005.
We're developing a C++ application for an embedded device in Visual Studio 2005. This application is pure standard C++ (i.e. unmanaged, no Microsoft extensions, no Windows CE or similar on the device). These application consists of several VS projects, each of them compiled into a static lib. We also added a Win32 application, that can be used to run the embedded application on a Windows PC -- some kind of "simulator" for the embedded device.
As we load a binary configuration file into the embedded device I added a managed Windows Forms application to the solution, that can create such binary configuration files. This application uses some of the unmanaged libs (to access some structs and to use some basic methods, e.g. checksum calculation). It was no problem to use the unmanaged libs in the managed Windows Forms application.
Then we got the requirement that it must be possible to create the configuration files automatically from a command line. So I decided to split up the Windows Forms project into an application project, that only contains the GUI, and a library project, that does the actual conversion work -- and to add a second application project, that contains a command line tool. And here we have the problem: I don't get things working with this library.
I tried putting my "conversion worker" classes into a (managed) static lib, that links the (unmanaged) static libs from the embedded application. This works, I get a .lib file. But if I try to add the library project in the "References..." dialog, I get the error:
fatal error C1113: #using failed on 'xxx\myConversionWorker.lib'
If I remove the reference and try adding the lib file as an additional dependency instead, I get hundreds of "error LNK2020: unresolved token" messages (all referring to managed functions in the xxx\myConversionWorker.lib).
Then I tried to use a dynamic dll instead of a static lib. Then I get a lot of other errors when building the dll, e.g.
error C2011: 'namespace::classname' : 'class' type redefinition
error C2027: use of undefined type 'namespace::classname' (with the same 'namespace::classname' as the C2011!!)
error C2275: 'System::IO::FileInfo' : illegal use of this type as an expression
error C2275: 'System::String' : illegal use of this type as an expression
as well as lots of
error C2065: 'variableName' : undeclared identifier
and so on.
How do I get this to work? What I want to do, in short:
Create a managed application (Windows Forms or command line), that uses a managed library (lib or dll), which itself uses unmanaged static libs.
Thanks a lot!