visual studio - LNK2005 error because I have two c++ windows running parallel -


i working on uni project multiple tasks, , trying debug simple program, getting error "lnk2005 main defined in task 1".

i realise because have used "int(main)" both tasks (i have code task 1 , code task 2). not want have create new project folder every task. there way around ?

while advisable have project each executable build, can away having single project multiple executables if manage somehow rid of undesired duplicate mains. have quite few options available you:

  1. have 1 main. have test own executable name, , take specific action depending on name finds. in post-build rules, set rules creating each (specifically named) executable base executable. allows build executables @ same time in efficient manner.

  2. have multiple mains, hide them using #ifdefs. add #define project settings or somewhere above main(), , compile needed. ok if don't want build executables time.

  3. just bite bullet , set multiple projects.

whatever do, consider being able build have in single step considered highly desirable trait of build systems, , high on list of features engineered development process should have.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -