How to make a program create a new folder

Pages: 123
We can still try right ?
^See my previous post - I beat you to it by half a minute (as Disch would say, NINJA'D). Anyway, yes, we can still try.
OK so so far i have

Base :
C:\Program Files (x86)\boost


Include:
C:\Program Files (x86)\boost\boost_1_46_1\boost


Then in the source code
#include <boost/filesystem.hpp>

And i get the error :
boost/filesystem.hpp: No such file or directory|

Just to clarify do you know about search paths/include directories?
I probably do except i learned c++ back in poland , so im not familiar with the english name so could you clarify what are search paths and include directories .
A compiler search path is a directory path given the compiler so it knows where to look for header files. That is why, for example, you can include <iostream> without qualifying the full path.

Do you know how to set search directories in Code::Blocks? if not, a quick google search should yield the answer ;)
Well i did add the search directories and it still cant find the boost\filesystem.hpp file , i think my codeblocks is bust , ill try visual studio , would express do ?
Express is great, but Code::Blocks will work too. You said you added this as your include path:
C:\Program Files (x86)\boost\boost_1_46_1\boost

Remove the final "boost", as you provide this in the include directive
#include <boost/filesystem.hpp>
Ok i did that now i get this compile error log
C:\Program Files (x86)\boost\boost_1_46_1\boost\filesystem.hpp|15|error: boost/config.hpp: No such file or directory|
C:\Program Files (x86)\boost\boost_1_46_1\boost\filesystem.hpp|34|error: boost/filesystem/v3/config.hpp: No such file or directory|
C:\Program Files (x86)\boost\boost_1_46_1\boost\filesystem.hpp|35|error: boost/filesystem/v3/path.hpp: No such file or directory|
C:\Program Files (x86)\boost\boost_1_46_1\boost\filesystem.hpp|36|error: boost/filesystem/v3/operations.hpp: No such file or directory|
C:\Program Files (x86)\boost\boost_1_46_1\boost\filesystem.hpp|37|error: boost/filesystem/v3/convenience.hpp: No such file or directory|
||=== Build finished: 5 errors, 0 warnings ===|
You changed the include directive to #include <filesystem.hpp>, didn't you? You need to change your include path to C:\Program Files (x86)\boost\boost_1_46_1 instead.
Ok i did that but now i just get one error :
|5|error: boost\filesystem.hpp: No such file or directory|
So your compiler search path is
c:\program files (x86)\boost\boost_1_46_1\

and your include directive is
#include <boost/filesystem.hpp> ?
I dont know how but i went tru the thread again and followed all your instructions Xander314 and got it working thank you :D

Now how do i make the program create a new folder named C++ on the desktop ?
Last edited on
To make a folder, you use the function boost::filesystem::create_directory, passing your required directory path as a single string argument. I don't know how to autofind the desktop folder - this is probably OS specific (WinAPI again...).

Also, we are barely started with boost yet: if you try to use a boost::filesystem function and then build your project, you will get linker errors. We still need to build boost.

If you want to try this, then OK. But be warned, Boost might not be able to find the desktop folder for you anyway. This might require WinAPI.
OK so how do we build boost ?
Well firstly, read section five of the Boost getting started guide:
http://www.boost.org/doc/libs/1_46_1/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary

Section 5.2 is the ideal way IMO, but it isn't quite that simple. Read it and once you think you have some idea of how it works, let me know. I can then tell you the commands to give to Visual Studio command prompt when I have the chance to find them.
Im still using code blocks though ok and i read that
Oh, looks like the documentation only discusses Visual Studio. Failing that, I'm not really sure. The process should be similar for Code::Blocks. Perhaps someone else on here knows?
Im downloading Visual C++ 2010 Express right now :D
Okay - sorry I couldn't help you with Code::Blocks, but I should be able to for VCE. I prefer it anyway :p

EDIT: When you've downloaded it, see if you can make a new project and set the Boost search directory (in Visual C++ Express, search directories must be set per project).
Last edited on
Pages: 123