I tried to compile a simple C++ program that uses stdlib. First it did not find stdlib. So I installed all the C++ development pattern packages in yast. Afterwards, algo.h was still missing, so I downloaded it from koders.com. But now it gives me a compile error. Could it be that algo.h is not compatible, what package contains it and how can I install it? Many thanks, I am at a loss!
linux-c6m1:/home/dorien/C++/DMusic # gcc Main.c++
In file included from Main.c++:5:
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:29:22: error: includes.h: No such file or directory
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:30:20: error: buffer.h: No such file or directory
Main.c++:6:20: error: vector.h: No such file or directory
Main.c++:7:22: error: iostream.h: No such file or directory
In file included from Main.c++:5:
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:83: error: variable or field ‘buf_put_algolist’ declared void
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:83: error: ‘buffer’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:83: error: ‘buf’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:83: error: expected primary-expression before ‘localalgos’
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:85: error: ‘buffer’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:85: error: ‘buf’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:85: error: expected primary-expression before ‘localalgos’
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:86: error: expected primary-expression before ‘int’
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:86: error: initializer expression list treated as compound expression
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:87: error: ‘buffer’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:87: error: ‘buf’ was not declared in this scope
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:87: error: expected primary-expression before ‘localalgos’
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:88: error: expected primary-expression before ‘int’
/usr/lib64/gcc/x86_64-suse-linux/4.3/include/algo.h:88: error: initializer expression list treated as compound expression
Main.c++: In function ‘int main(int, char**)’:
Main.c++:18: error: ‘vector’ was not declared in this scope
Main.c++:18: error: expected primary-expression before ‘int’
Main.c++:18: error: expected `;' before ‘int’
Main.c++:20: error: ‘cin’ was not declared in this scope
Main.c++:21: error: ‘music’ was not declared in this scope
Main.c++:22: error: ‘music’ was not declared in this scope
Main.c++:22: error: ‘sort’ was not declared in this scope
Main.c++:23: error: expected ‘,’ or ‘;’ before ‘)’ token
Main.c++:25: error: ‘cout’ was not declared in this scope
#include <stdlib.h>
#include <string.h>
#include <algo.h>
#include <vector.h>
#include <iostream.h>
int main( int argc, char **argv )
{
vector<int> music;
int input;
while (cin >> input)
music.push_back (input);
sort (music.begin(), music.end());
int aantalnoten = music.size());
for (int i=0; i < aantalnoten; i++)
cout << music* << "
";
}
>
>I does not seem to work yet:
>
>
>Code:
>--------------------
>
> #include <string>
> #include <algorithm>
> #include <vector>
> #include <iostream>
>
> using namespace std;
>
>
> int main( int argc, char *argv )
> {
> vector<int> music;
> int input;
> while (cin >> input)
> music.push_back (input);
I did not think that this would be the right call for sort in a
vector<int> template.
> sort (music.begin(), music.end());
I am however quite certain that there is a much more c++ iterator to walk
the vector<int>.
> int aantalnoten = music.size();
> for (int i=0; i < aantalnoten; i++)
> cout << music << "
";
> }
>
>
>--------------------
>
>
*