Switch projects requires rebuild of VC++ project

J

JS

I have two C# libraries and a managed C++ library which depends on the
C# libraries.

I have several applications which reference all of these libraries.
Whenever I change from one application to another, the managed C++
library does not build. It generates hundreds of errors. However, if
I do a rebuild of the solution or the C++ project, it builds fine and
all builds thereafter are OK.

Is this a known issue? It's a minor inconvenience but I'd like to fix
it.
 
R

raylopez99

Whenever I change from one application to another, the managed C++
library does not build. It generates hundreds of errors. However, if
I do a rebuild of the solution or the C++ project, it builds fine and
all builds thereafter are OK.

Not sure what you mean by "change from one...to another", but I'm not
an expert at compile options either. Forward references missing
maybe?

RL
 
J

JS

I have 2 solutions Solution1 and Solution2. Each one includes my core
libraries which consist of some C# libraries and a managed C++
library.

If I'm working in Solution1, everything compiles OK. Then I close
Solution1 and open Solution2. If I press 'build', the C++ library has
hundreds of errors. I always need to manually select 'rebuild' either
on the entire solution or on this C++ library. I must do this
whenever I open one of my solutions.
 
R

raylopez99

I have 2 solutions Solution1 and Solution2. Each one includes my core
libraries which consist of some C# libraries and a managed C++
library.

If I'm working in Solution1, everything compiles OK. Then I close
Solution1 and open Solution2. If I press 'build', the C++ library has
hundreds of errors. I always need to manually select 'rebuild' either
on the entire solution or on this C++ library. I must do this
whenever I open one of my solutions.

Sorry I can't help you. Perhaps C# and Managed C++ (which is obsolete
with the advent of C++.NET 2.0?) can't get along. I have hard enough
time getting all the translation units and modules of C++.NET 2.0 to
talk to one another (the other day I had a conflict between SortList
in the MS collection class and the equally named SortList from the
generic collection class, that I resolved after stenuous effort using
namespaces and scope resolution opeators; what a bear for a simple
demonstration program).

I pity you professional programmers.

Best of luck,

RL
 
W

William DePalo [MVP VC++]

JS said:
I have 2 solutions Solution1 and Solution2. Each one includes my core
libraries which consist of some C# libraries and a managed C++
library.

If I'm working in Solution1, everything compiles OK. Then I close
Solution1 and open Solution2. If I press 'build', the C++ library has
hundreds of errors. I always need to manually select 'rebuild' either
on the entire solution or on this C++ library. I must do this
whenever I open one of my solutions.

From what little I know of your goal, it seems to be that you need to create
a single solution with two projects. Making one project dependent on the
other should insure that the builds are done in the correct order.

Regards,
Will
www.ivrforbeginners.com
 
J

JS

Each of my solutions includes the library projects. The C++ project
references the C# library, and the solution refererences both of
these.

i.e.:

Solution1
- Project1 (WinForms exe)
[references: System.* dlls, CSharpLib, CPPLib]
- CSharpLib (class library)
[references: System.* dlls]
- CPPLib (class library)
[references: System.* dlls, CSharpLib]

Solution2
- Project2 (WinForms exe)
[references: System.* dlls, CSharpLib, CPPLib]
- CSharpLib (class library)
[references: System.* dlls]
- CPPLib (class library)
[references: System.* dlls, CSharpLib]

The situation is that I have Solution1 open, and it is building fine.
Then I close Solution1 and open Solution2. I must rebuild either the
entire Solution2 or else the CPPLib or else CPPLib generates hundreds
of errors.

As I said in my first post, this is annoying but I can live with it.
I was thinking that this might be known behavior and there would be a
way to fix it. It sounds like I'm the only one, so it must have
something to do with my project configurations, I guess.

Also, I am not aware of managed C++ being obsoleted with .Net 2.0 (as
a previous responder suggested). I have a lot of calls I'm making
into some C and C++ dll's so rather than using interop, I decided to
make a managed C++ dll.

Thanks.
 
B

Ben Voigt

JS said:
Each of my solutions includes the library projects. The C++ project
references the C# library, and the solution refererences both of
these.

i.e.:

Solution1
- Project1 (WinForms exe)
[references: System.* dlls, CSharpLib, CPPLib]
- CSharpLib (class library)
[references: System.* dlls]
- CPPLib (class library)
[references: System.* dlls, CSharpLib]

Solution2
- Project2 (WinForms exe)
[references: System.* dlls, CSharpLib, CPPLib]
- CSharpLib (class library)
[references: System.* dlls]
- CPPLib (class library)
[references: System.* dlls, CSharpLib]

The situation is that I have Solution1 open, and it is building fine.
Then I close Solution1 and open Solution2. I must rebuild either the
entire Solution2 or else the CPPLib or else CPPLib generates hundreds
of errors.

As I said in my first post, this is annoying but I can live with it.
I was thinking that this might be known behavior and there would be a
way to fix it. It sounds like I'm the only one, so it must have
something to do with my project configurations, I guess.

Perhaps you are sharing an output directory, with different compiler
options? Use a different intermediate and output directory for each
solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top