Confused Includes

| | Comments (1) | TrackBacks (0)

I sometimes end up talking with folks that seem to have duplicate items in the entity filter. In this case the function osTime appears twice in the function list.

image

The first thing I notice is that we have the source code for one of the entities and the other is undefined (grayed out). This makes me suspicious that they are probably the same object. Next I compare the information browsers for these two items. There are a couple bits of information I need to track this down.

image

So the defined function is declared in os.h, and there are two function calls are in stats.cpp.

So I pull open the include tree for stats.cpp, right out of the info browser:

image

image

so stats.cpp does include os.h, so they should be the same function...But when I double click on os.h on the graph, I get an error.

image

So, they are the same function, but for some reason, os.h is not getting included correctly in the project. This could happen for several reasons. Most of them can be addressed through correctly setting up the includes options under Project | C++ | Includes

image

More information about each of these options can be found in the help file.

In my case, I realized that the include files are part of my project files, and I checked the appropriate checkbox. After re-parsing the project, the extra, unknown function disappeared from my entity list, and all of the references were associated with the same function. Hurray!

image

0 TrackBacks

Listed below are links to blogs that reference this entry: Confused Includes.

TrackBack URL for this entry: http://scitools.com/blog/mt/mt-tb.cgi/52

1 Comments

I do this a lot as well in my support activities.

One caveat I'd like to make clear is that unknown or unresolved items aren't necessarily errors. We indicate their status mainly for information purposes. We generally show unresolved or unknown entities grayed out.

Unresolved= found declaration, didn't find definition. This is common , especially when using libraries. For instance "printf" is almost always unresolved because its definition is usually not available in source. You declared it by including but you won't have the source for it - it comes from the C standard library part of your runtime library.

Unknown = found uses, found no declaration or definition. This is an error, but if you can fix it or need to fix it depends on your situation. For instance, if you are doing IVV and don't have all the source code, fixing it won't be an option you can pursue.


Leave a comment

About this Entry

This page contains a single entry by KevinG published on May 6, 2008 4:25 PM.

Understand 2.0 - using only the right pane in the diff view was the previous entry in this blog.

Understand 2.0 Build Notes (b444) is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.