Problem is solved. I have got the answer from here. To summarize I needed to link my exe project with the lib project which contains the function fun()
. Now the simplest way to make the .exe project link against .lib project probably is by adding a reference:
- In the .exe project's settings, select the section named "Common Properties" at the top of the section list.
- You should now see a list of references that the .exe project has. The list is probably empty.
- Click the "Add new reference" button at the bottom of the dialog and add the .lib project as a reference
- When you select the new reference in the list of references you will see a set of properties for that reference. Make sure that the property called "Link Library Dependencies" is set to true. This will cause the .lib project to be added automatically as an input to the linker when you build the .exe project.
After that the linker error was gone.