Questions about includes

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Barts_706
Posts: 38
Joined: Tue Jan 24, 2006 2:21 pm
Contact:

Questions about includes

Post by Barts_706 »

Hi,

After playing a little bit with samples from SDK and a few simple programs of my own, I started porting one or other piece of code.

I need some includes, but I am not sure where and how to get them.

In Windows I would use (well, among others) :
#include <math.h> <- no problem with this one
#include <sstream>
#include <string>
#include <vector>
#include <limits>
#include <cassert>
#include <iomanip>
How do we include vectors? What about other STL and std c++ functions, classes and utils?

How do we add the files from this directory (see below) ?
c:\cygwin\usr\local\pspdev\include\c++\4.0.2\

I searched the forums, but I thought I'd ask nevertheless to be sure I understand it well.
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

hey dude...

just #include them like you would in Windows.. as long as they've been added to your environment (are you using Linux or Windows to code? most probably cygwin or something right?!) -- anyways.. I'm pretty sure you dont need to worry, they libraries are portable and you can use the regular c/c++ libs as long as they are set up in your environment properly when you go to compile. try compiling one of your c programs from the cygwin command line (have the file in the right dir), and run

Code: Select all

gcc myFile.c -o myFile
than run

Code: Select all

./myFile
and that will let you know whether or not you have the right libs installed... im sure that you would tho if you've made it this far... and also (i could be 100% wrong abot all of this :) ..but yeah, if gcc and g++ are installed, you should be fine) ... um.. respond with somethin:P
-----------------
Everything should run normally, if you just #include it... if not, then you dont have the environment set up properly..
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

If this code is from MS:VC 6, or some other non standard compiler then you may be missing the line "using namespace std;" after your includes.

Code: Select all

#include <math.h>
#include <sstream>
#include <string>
#include <vector>
#include <limits>
#include <cassert>
#include <iomanip> 

using namespace std;
^^ Something like that.
Post Reply