If your solution includes several projects, then right-click the main project (which generates the application) in Solution Explorer and select “Set as Startup Project”.
StaticLib.lib is not a valid win32 application-ERROR
I use Win 10 Visual Studio 2019.This error will be like that: Library/Debug/StaticLib is not a valid Win32 application.
I try many methods on Internet but it's failed.
Please help me, thanks you so much.
2 answers
Sort by: Most helpful
-
-
Jeanine Zhang-MSFT 9,771 Reputation points Microsoft Vendor
2020-08-11T05:33:07.697+00:00 Hi,
Did you get the error like this?
As far as I'm concerned, it may build correctly but you're trying to run the .lib like an application. You should right click on the project and select 'Build' like the following show.
After you finish building the .lib project, you will get a .lib file like this in the debug folder.
And then you could add it to your C++ project:
1,Add the path to the header file to the Additional Include Directories(property - >c/c++ -> General -> Additional Include Directories)
2,Add the path to the .lib file to the Additional Library Directories (property -> linker -> General -> Additional Library Directories)
3,Add the name of the .lib file with its extension to Additional Dependencies (property -> linker -> input -> Additional Dependencies)For more details about how to use a static library, I suggest you could refer to the Doc.
Thank you!