Excluding files from build?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

I am just started to try to work with studio 5 and have a problem with the fact that I have two targets in the project that use different files.

I can exclude one of the files from the build but when I exclude it from one target it is (also) excluded for the other target. When I put it back in the other target it gets activated again in the first target - therefore it seems to only be possible to exclude files from all targets or none. I note also that there is no indication of whether the files(s) are excluded from the build or not (normally VS indicates this).

Any ideas? I wish that it would behave more like standard VS projects but it seems as though it is VS IDE with Eclipse mentality in the background... I'll keep battling.

Regards

Mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried excluding a file from a C++ project in VS 2010 - excluding a file excludes it in all configurations of the project (I'm assuming you mean configurations like Debug, Release when you say target).

If you want to look at files/folders in the project directory that aren't part of the project, you can turn on Show All Files (the second toolbar button in the Solution Explorer window).

Regards

Senthil

 

blog | website

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

When I work with VS C++ 2010 and have targets Debug and Release I can exclude a file from just the release target (configuration) and have it still build in the debug target. When excluded, it shows the file with a red "no-entry" type symbol. When the alternative target is selected this symbol is not shown and the file is compiled.

When I do the same in Studio 5 the exclude is valid for all targets and the symbol is not displayed - one has to check in each file property to see what state it is infact in.

The reason why I would like to do this is in fact that I would like three "projects", each set up as a target (configuration). Then I can switch between building each project with the target button.

This is in fact a workaround that I previously used in Eclipse environments due to the fact that the three projects share several directories (operating system, TCP/IP stack, Drivers, FAT file system) and each has just its own application directory. If three projects are created for each one Studio 5 creates individual project directories with copies of each folder and file, which means that the library directories are no longer shared and need to be maintained individually - which is horrible to have to do.

When working with VS C++ 2010 the folders created in the project are 'virtual' folders and the included files are simply paths to their source, but in Studio 5 (with similar mentality to Eclipse) creating a project creates a new directory stucture and copies the original files into it (workspace). This is different to the operation of most IDEs (like IAR, Keil etc.) and makes sharing parts of projects a real mess. With Eclipse it was at least possible to not copy the files to the workspace but I couldn't fnd such an option in Studio 5. Furthermore, the trick of using targets (configurations) to exclude application files also worked (with more or less effort dependig on exact Eclipse package - some allow complete folders to be excluded with a single mouse click while others require each individual file to be excluded manually, which can take some time and effort).

I am sure that there are better methods but I was hoping that it would be as simple as working with the standard VS but Studio 5 seems to have a lot of quirks in its operation which have nothing to do with VS but seem to be more like the Eclipse type project management in the background (which I have always found terrible to actually try to work with and have actively avoided when ever possible).

Regards

Mark

P.S. I don't have the second tool bar in the window so perhaps I need to upgrade the version. I'm not sure whether I have the Beta or the first release one so'll I'll try upgrading again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for the revive - did you ever find a way to do this?  I'm using 6.2, and although the icon indicates whether or not the file is included to be compiled, it is still a global setting, and not per configuration.

Any workarounds?  Or a switch I can't find or don't know of I can add in "Custom Compiler Setting"?