I have a project containing both native and managed C++ code.
Its runtime support is set to /clr
.
Its configuration type used to be set to Application
, such that it compiled to an .exe
. This worked all fine.
But now I want to use this project as a library (.dll) for another project.
So I change the configuration type to dynamic library and rename the main()
function to something else.
Then rebuilding the project gives the following two errors.
Error 2 error LNK1120: 1 unresolved externals C:\Projects\MyProject\Source\Debug\MyProject.dll MyProject
Error 1 error LNK2001: unresolved external symbol _main C:\Projects\MyProject\Source\CppSource\LINK MyProject
The corresponding output is as follows.
1>------ Build started: Project: MyProject, Configuration: Debug Win32 ------
1> Main.cpp
1>LINK : error LNK2001: unresolved external symbol _main
1>C:\Projects\MyProject\Source\Debug\MyProject.dll : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Am I forgetting something here?