Moin,
Versuche gerade eine cms mit c++ zu schreiben versuche jetzt funktionen in shared libary's zu schreibe, dies ist für mich neuland.
Mein c++ code
index.cpp
css.cppCode:#include <iostream>
#include <string>
#include <fstream>
#include "index.h"
#include <dlfcn.h>
#include "lib/libcss/include/css.h"
using namespace std;
int main()
{
dlopen("lib/libcss/libcss.so", RTLD_LAZY);
cout << "Content-type: text/html" << endl
<< "<html>" << endl
<< "<head>" << endl
<< "<title>Wikommen auf Tuxist Mainbase</title>" << endl
<< "</head>" << endl;
cout << cssheader;
cout << "<body>" << endl
<< "<h1><em>" << endl
<< "Im Aufbau" << endl
<< "</em></h1>" << endl
<< "</body>" << endl
<< "</html>";
}
css.h (css header)Code:
[/CODE#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class libcssread
{
public:
char cssheader;
ifstream cssread;
string csspath;
};
int main()
{
char cssheader;
ifstream cssread;
string csspath;
cssread.open(csspath.c_str());
while (cssread.eof() !=true)
{
cssheader = cssread.get();
cssread.close();
}
}
]
g++ outputCode:class libcssread
{
public:
char cssheader;
ifstream cssread;
string csspath;
};
Code:make
/usr/bin/gcc -Wall -fsigned-char -Ilib/libcss/include -Llib/libcss index.cpp
lib/libcss/include/css.h:5: error: ‘ifstream’ does not name a type
lib/libcss/include/css.h:6: error: ‘string’ does not name a type
index.cpp: In function ‘int main()’:
index.cpp:22: error: ‘cssheader’ was not declared in this scope
make: *** [all] Fehler 1