how to disable autoinclude in visual studio

Nov 4, 2011 at 6:49am
hi,
I'm geting sick of MSVS C++ while it autoincludes headers so I basicaly have no need to include anything except <iostream> and "using namespace std"

how do I disable that behavior of C++ express?

for example if I want to use log function then <cmath> should be included, but log function will work anyway, wether <cmath> will be included or not.

for example:
1
2
3
4
5
6
7
#include <iostream>
using namespace std;

int main() {
    cout << log(33.333);  //that works just fine without <cmath> 
    return 0;
}
Nov 4, 2011 at 7:22am
closed account (DSLq5Di1)
There is no auto include behaviour.. by including iostream you are indirectly including cmath.

Open up the iostream header and follow the include chain, you should eventually end up at xlocnum, which includes cmath and some other c run-time headers.
Nov 4, 2011 at 2:33pm
tnx for your reply,
may I ask why is that so? (I'm curious person btw. lol)
by the way when you create new solution there is folder named "external dependencies", for what is that folder used for?
Nov 4, 2011 at 2:43pm
closed account (1yR4jE8b)
It's just the way that Microsoft implemented the C++ standard library, they wanted to use some <cmath> functions in <iostream> so they needed to include it in the header file.

That external dependencies folder is just a view for you to see what is part of your program, there is not 'actual' folder -- it's just a virtual one created on the fly by VS for you convenience.
Nov 4, 2011 at 2:56pm
That external dependencies folder is just a view for you to see what is part of your program

you mean part of visual studio? (currently all availabe ready to include), if I understood, theay are not acctualy #included into my project?
Nov 4, 2011 at 3:00pm
They are included in your project settings but not your source code. Play around with project property pages by right clicking a project in solution explorer and selecting properties
Nov 4, 2011 at 3:07pm
hi, sorry if i'm tedious..
They are included in your project settings but not your source code

what does that acctualy mean?
Nov 4, 2011 at 3:50pm
So visual studio has files with the extension .vcproj, they are just XML files and you can view them in your favorite editor (I suggest notepad++ if you're on windows :)

Anyway, editing them in XML is really hard to do if you don't know what you're looking at, so visual studio provides a UI for all of this stuff. If you right click on your project file in visual studio you can select "properties" from the right click menu.

In the property sheets there are things like Linker -> Additional dependencies, these are an example of something that you can include in your project without having them in source code. I think I'm probably confusing you at this point.

My advice would be to play around with the property sheets in visual studio using their UI and see what you can get out of that. If you ever need to make a ton of changes to your property sheets, I would recommend directly editing the XML.

I hope that helps (though I doubt it)
Nov 4, 2011 at 3:58pm
closed account (1yR4jE8b)
He's using Visual Studio, fairly safe bet it's on Windows ;)

you mean part of visual studio? (currently all availabe ready to include), if I understood, theay are not acctualy #included into my project?


No, this are all of the files that have been included in your project that aren't code you have written yourself; like standard library headers.

When you include <iostream> in your project, it shows up here. If you remove it, it is removed. Other headers included by <iostream> are inherently part of this view as well. <cmath> is included by <iostream> so if you include <iostream> both it and <cmath> will show up here.
Nov 4, 2011 at 6:30pm
so if I include wxWidgets headers into my project using project properties, they will show up in that "external dependencies" folder?

means I'll be available to include them into my source files and start using wxWidgets futures?
Topic archived. No new replies allowed.