Вот исходный код:
Код: Выделить всё
#include "headers.h"
std::string readFileToString(const std::string &filePath) {
std::ifstream file(filePath);
std::stringstream buffer;
buffer setTitle("App");
this->doJavaScript(std::async(std::launch::async | std::launch::deferred,
readFileToString,
"D:/web/script.js"
).get());
auto image = this->root()->addWidget(std::make_unique(""));
image->setAttributeValue("src", "icons/image.png");
image->setAttributeValue("alt", "image");
image->setId("main-image");
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment &env) {
auto app = std::make_unique(env);
return app;
});
}
image.png:1
Вот что пишет браузер:
GET http://127.0.0.1:8000/icons/image.png 404 (не найден)
Подробнее здесь: https://stackoverflow.com/questions/786 ... file-to-wt