stl.h I can't solve this problem

Hello, I am trying to fix errors on a code I extract from a pdf book.
Now When I compile it still give me problems related to stl.h library.

The following is the code:


#include<iostream> // Header file for receiving input and generating output.
#include<stdlib.h> // Header file containing C++ standard libraries.
#include<iomanip> // Header file for manipulating output.
#include<fstream> // Header file for using files.
#include<time.h> // Header file for calculating iteration times.
#include<math.h> // Header file for mathematical functions.
#include<stdio.h> // Header file for standard input/output.
#include<stl.h> // Header file for Standard Template Library (STLs) <set, multiset>.
#include<sstream> // Header file for manipulating strings.

// Fitness of playing set is given by: fitness = # vertices dominated by candidate / # vertices in graph = psi l (m, n; k)

//APPENDIX A. COMPUTER PROGRAMS

long double fact (const int &);
long int round (const long double);
bool ValidTicket (const short int *, const short int &, const short int &);

// Compute the factorial of n (i.e. n!).
long double fact (const int &n) {
if (n < 2) return 1; // Stop recursion.
else return n * fact(n - 1); // (n > 1).
}
// Rounds a number off to the nearest integer to avoid possible numerical truncation errors.
long int round (const long double n) {
long int flrnum = (long int)floor(n);
if (n - flrnum < 0.5) return flrnum;
else return (long int)ceil(n); // (n - flrnum >= 0.5)
}
// Determine whether a ticket (n-set) is valid (ticket contains no double numbers).
bool ValidTicket(short int *ticket, const short int &m, const short int &n) {
multiset<short int, less<short int> > index;
multiset<short int, less<short int> >::iterator i;
for (short int counter = 0;counter < n;counter++) {
index.insert(ticket[counter]); // Add number to index.
if (index.count(ticket[counter]) > 1) return false; // Ticket is invalid.
}
i = index.begin(); // Arrange ticket elements lexicographically.
for (short int counter = 0;i != index.end();ticket[counter++] = *i++);
return true; // Ticket is valid.
}
.
.
.

...

.
.
.

GAFitnessFile << setw(3) << curgen; // Write population fitness to file.
for (TempFitness = FitnessList;TempFitness->next != NULL;TempFitness = TempFitness->next)
GAFitnessFile << setw(9) << TempFitness->next->fitness;
GAFitnessFile << endl; cerr << ‘.’;
if ((long int)(curgen/20) == (float)curgen/20) cerr << " (" << setw(4) << curgen << "/" << gen << ")" << endl;
}
GAFitnessFile << "GA simulation time: " << time(NULL)-StartTime << "s." << endl;
GAFitnessFile.close(); // Close the Genetic Algorithm (GA) Fitness file.
GAPopulationFile.close(); // Close the Genetic Algorithm (GA) Population file.
cout << endl;
return 0; // Exit program.
}



I don't have any stl.h file on my C: drive..

Does anyone can tell me how to do?

Thanks in advance
Last edited on
just
1
2
#include<multiset>
#include<vector> 

or whatever you need etc.
The code looks old. Try including the <set> header instead.
adding

#include<multiset>
#include<vector>

#include <set>

now it returns the following error:

...\Documenti\Progetti di Visual Studio\al7\al7.cpp(13): fatal error C1083: Impossibile aprire il file inclusione "multiset": No such file or directory

I am using Microsoft Visual C++ .NET

Should I try a different compiler?

thanks
#include<multiset> does not exist. Just #include <set> . See

http://www.cplusplus.com/reference/set/multiset/?kw=multiset
yep my apologies. i incorrectly misinterpreted the top of this page:
http://www.cplusplus.com/reference/set/multiset/
Thank you.
Better now.
Topic archived. No new replies allowed.