Re: class wizard / conditional compilation

From: Lisa Pearlson (no_at_spam.plz)
Date: 01/10/05


Date: Mon, 10 Jan 2005 23:06:53 +0100

But how do I add multiple files of the same name to the project?

It seems I have to add all 3 versions, and then for each configuration,
exclude 2 out of 3 of those files from compilation. (Knowing which file is
which is very hard from within project settings).. and give each file a
different output file, because even with excluding the files from
compilation, the IDE still complains all 3 of those files output the same
obj file in the same location, and refuses to compile.

Damn this is complicated when it could be so simple if you could do per
configuration project settings.
Perhaps I should create 3 different project files instead.

Lisa

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
news:1105393019.116212.147210@f14g2000cwb.googlegroups.com...
> #include "Winawsvr.h" //
>
> Of course you need the above line if you want to access types in that
> file or other files included in above file.
>
> You need *.cpp in you *project* if you want to compile the code in that
> file. These two are different things. You are confusing project and
> class browser. You will add .cpp files to the project. If you dont add
> these to the project, these will not get compiled. If you want to
> compile the files, you must add these to the project.
>
> The problem I addressed was different; it simply showed how to access
> various versions of one file(same name) in your project. You still need
> this.
>
> -----------
> Ajay Kalra
> ajaykalra@yahoo.com
>
> Lisa Pearlson wrote:
> > I am using VS6 and I have included the directories.
> > Under Project Settings, I choose the C/C++ tab and under category
> > "Preprocessor" I can enter "Additional include directories:" .. this
> > automatically includes the /I in the compiler params.
> >
> > But this isn't working at all.
> >
> > My directory structure is like this:
> >
> > <project directory>\<main files>
> > <project directory>\pca\9.2\awrem32.cpp/h
> > <project directory>\pca\10.5\awrem32.cpp/h
> >
> > I need awrem32.cpp/h for some function calls in MainFrm.cpp
> > So
> >
> > MainFrm.cpp:
> >
> > #include "stdafx.h"
> > #include "HTMap.h"
> > #include "MainFrm.h"
> > #include <Atlbase.h> //CRegKey
> >
> > #include "Winawsvr.h" // <--- this must be included
> >
> > If I don't include the line above, I get a bunch of undelcared
> identifier
> > errors since those are defined in the awrem32.h file.
> > When I include "awrem32.h", without telling inside the project
> settings
> > where this file can be found (additional include directories), I get
> not
> > found error, but when I do add these settings per configuration, it
> seems to
> > work, but fails at linking stage.
> >
> > The issue is still, do I or do I not add "awrem32.h" and .cpp files
> to the
> > class browser or not. I wish I could include it per project setting..
> in
> > other words, I can include different files for different project
> settings.
> > Without that, it just doesn't seem to link, because it doesn't
> compile,
> > because it isn't known by the class wizard.
> > So I get link errors.
> >
> > So I do believe I must do my
> >
> > #include "awrem32.h"
> >
> > But since that file is not in the root of the project directory but
> in a sub
> > directory, I tell each project settings where to look for that file..
> but to
> > actually get it to compile, and link, it needs to show up in the
> class
> > wizard. ;-(
> > I can't get this to work.. should be so simple.
> >
> > Lisa
> >
> > "Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
> > news:1105388740.033016.93970@f14g2000cwb.googlegroups.com...
> > > Include path is the /I option. You can specify the include paths
> for
> > > each project under properties of the project. In VS7, You can get
> to
> > > properties by right clicking on the project and clicking
> properties..
> > > It is under Properties::C/C++::General. It appears on top as
> Additional
> > > Include Directories. Do this for all the configurations. Also
> remember
> > > to take of the hard coded path from your file.
> > >
> > > --------------
> > > Ajay Kalra
> > > ajaykalra@yahoo.com
> > >
> > > Lisa Pearlson wrote:
> > > > Thanks, that's what I did.. I just can't find the place to add
> the
> > > > additional include paths.
> > > > Anyway, does this mean I should not have to import the file into
> > > class
> > > > wizard? (and so it does not show up in the class browser in the
> left)
> > > ?
> > > >
> > > > Lisa
> > > >
> > > > "Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
> > > > news:1105382934.908509.158340@c13g2000cwb.googlegroups.com...
> > > > > Since file name is same for all configurations, you could
> simply
> > > change
> > > > > the Include path for each of the configurations. Remove the
> > > hardcoded
> > > > > path from the file and put that path as an include path. Create
> 6
> > > > > configurations (debug/release) and define include path for each
> > > > > (debug/release will have the same path).
> > > > >
> > > > > -------
> > > > > Ajay Kalra
> > > > > ajaykalra@yahoo.com
> > > > >
> > > > >
> > > > > Lisa Pearlson wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I need something like this:
> > > > > >
> > > > > > #if defined(_PCA92_)
> > > > > > #include "pca\\9.2\\Winawsvr.h"
> > > > > > #elif defined(_PCA105_)
> > > > > > #include "pca\\10.5\\Winawsvr.h"
> > > > > > #elif defined(_PCA115_)
> > > > > > #include "pca\\11.5\\Winawsvr.h"
> > > > > > #endif
> > > > > >
> > > > > > The defines I control by setting up different release mode
> files,
> > > > > just like
> > > > > > with Debug and Release versions, eg:
> > > > > > . Release - PCA92
> > > > > > . Release - PCA105
> > > > > > . Release - PCA115
> > > > > >
> > > > > > I can then select this from the drop down menu to compile the
> > > right
> > > > > version.
> > > > > >
> > > > > > However, the files can not be compiled unless they are
> imported
> > > into
> > > > > the
> > > > > > class wizard.
> > > > > > Since the file names are all the same, and all class
> definitions
> > > > > inside of
> > > > > > them, I can not include these 3 versions of files into the
> class
> > > > > wizard
> > > > > > simultaneously.
> > > > > >
> > > > > > I do not want to rename the files if possible, and do not
> want to
> > > > > include
> > > > > > all 3 files in 1 manually and seperate them with the #ifdef
> > > > > statements,
> > > > > > because these external files may change and I don't want to
> do
> > > any
> > > > > manual
> > > > > > stuff with them, only replace the files or add new versions.
> > > > > >
> > > > > > Can this be done?
> > > > > >
> > > > > > Lisa
> > > > >
> > >
>



Relevant Pages

  • Re: class wizard / conditional compilation
    ... Of course you need the above line if you want to access types in that ... You will add .cpp files to the project. ... compile the files, you must add these to the project. ... > found error, but when I do add these settings per configuration, it ...
    (microsoft.public.vc.mfc)
  • Re: VC2005, cant mix declarations and statements.
    ... > accepts it in the Release builds, not in Debug builds. ... I didn't change any other settings than the 'Compile as' ... "Compile as" setting may actually change very much. ... compiler settings you made in which configuration. ...
    (microsoft.public.vc.language)
  • Re: A little guidance please
    ... > I have successfully built both Gentoo and Rock from scratch apart from ... > to specify the cpu settings for the compile? ... > Reading the handbook it says copy the settings from ... > I did not do the cvsup as I have sources instaled from my minimal install ...
    (comp.unix.bsd.freebsd.misc)
  • A little guidance please
    ... I have successfully built both Gentoo and Rock from scratch apart from Rock ... I have managed to install FreeBSD and boot into it and have to say this does ... to specify the cpu settings for the compile? ... Reading the handbook it says copy the settings from /etc/defaults/make.conf ...
    (comp.unix.bsd.freebsd.misc)
  • Re: /RTC1 and /CLR options are incompatible
    ... > gotten it to compile and work correctly in VS.Net 2003. ... > I went into my project properties and changed Use Managed Extensions ... > It kind of looks like the problem is that the existing source files ... > project-level settings, and those settings are causing this error. ...
    (microsoft.public.dotnet.languages.vc)