开发者

Visual studio compile error

I as using visual studio 2010. My solution is having more than one projects in it which are have relationships to each. When I adding a reference to a other project I can use public components (classes,enums ) of that. But when I compile it it gives error saying that those classes are not referenced(Not available).

But when I change the folder structure(When I reduce the level of folder hierarchy/when projec开发者_Python百科t folders borings to the root folder ex: d:\ ) it works fine.

Is it because of the length of the folder hierarchi ?


  1. Check your namespaces
  2. When you're adding reference, add it using Project References. So what it does is it compiles the dependencies first. Check if all projects are compiling individually.
  3. Verify target framework versions


No, it is not because of folder hierarchy.... it is because not setting hierarchy properly !!

Follow this steps:

Lets say you have project A and project B. Project A is dependent on Project B. So we need to add dependency of Project B to Project A.

So right click on Project A -> Open Folder in File Explorer.

Then check which folder it opens into (Lets call it "source folder") and check where the project files whose dependency to be added (Lets call it "destination folder") are located from that folder location. Add the relative path from source to destination folder. (Ex: "..\..\destination folder" ). Add this relative path in Project A Properties -> Configuration Properties -> C/C++ ->Additional Include Directories.

Good luck.


Yes, hangar18 has suggested correctly. Add reference of each project (Static Libraries) to you execuatble project ( Console Application Project / Startup project). Also add path of each folder where the header files and corresponding C/C++ files are residing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜