Russell Trahan
Russell Trahan

Reputation: 791

Visual Studio 2013 C++/CLI Intellisense with Reference Library

I have a solution with multiple projects within it.

Project2 includes Project1 via the Common Properties->References interface in Project2's properties. Everything compiles perfectly fine; however, intellisense highlights any reference in project2's code to project1 as an error. Specifically I get the following types of messages.

In my *.h file in project2

#pragma once
namespace Project2
{
    class TypeInProject2
    {
        property Project1::TypeInProject1^ obj 
        { 
            Project1::TypeInProject1^ get();
            void set(Project1::TypeInProject1^ value);
        };
        //"Project1" is underlined in red
        //IntelliSense: name followed by '::' must be a class or namespace
    };
}

I can make intellisense happy by adding an include to the header in project1 but this results in redefinitions of all of the project1's classes and raises compile errors.

Are there any quirks I should know about in the C++/CLI project options to make intellisense happy?


Update: I should add that sometimes everything works correctly. But after exiting VS13 and then reopening the project all of the intellisense errors show up again.

Upvotes: 0

Views: 353

Answers (1)

David Yaw
David Yaw

Reputation: 27864

It could be that the Intellisense database is screwed up. Here's what I've done to correct it when it happens to me:

  1. Make sure your code is in a state where everything will compile.
  2. Exit Visual Studio
  3. Delete the .suo and .sdf files in the solution's directory. (Deleting the .suo probably isn't necessary to this cleanup process, but it doesn't hurt.)
  4. Open the solution in Visual Studio.
  5. Select Build --> Batch Build.
  6. In the Batch Build window, click "Select All", and then "Rebuild".

Upvotes: 3

Related Questions