подключение к cURL к проекту и проверка запуска - успешно

master
Yaroslav Spesivtsev 5 дней назад
Родитель 75383e1fd3
Сommit 96f7324eb0

@ -13,6 +13,7 @@
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add option="-DCURL_STATICLIB" />
<Add directory="curl/include" />
</Compiler>
<Linker>
@ -27,6 +28,7 @@
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add option="-DCURL_STATICLIB" />
<Add directory="curl/include" />
</Compiler>
<Linker>
@ -39,6 +41,7 @@
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
<Add option="-DCURL_STATICLIB" />
<Add directory="curl/include" />
</Compiler>
<Linker>

@ -0,0 +1,91 @@
# depslib dependency file v1.0
1747595453 source:c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\main.cpp
<iostream>
<vector>
"histogram.h"
"text.h"
<curl/curl.h>
<sstream>
<string>
1745795032 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\histogram.h
<vector>
1745791758 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\text.h
<vector>
1747164718 source:c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\svg.cpp
"svg.h"
<iostream>
<string>
<vector>
1745841059 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\svg.h
<iostream>
<string>
<vector>
1746443355 source:c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\text.cpp
"text.h"
<iostream>
<vector>
1745841101 source:c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\histogram.cpp
"histogram.h"
<vector>
<string>
"svg.h"
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\curl.h
"curlver.h"
"system.h"
<stdio.h>
<limits.h>
<sys/param.h>
<sys/types.h>
<time.h>
<winsock2.h>
<ws2tcpip.h>
<sys/select.h>
<sys/socket.h>
<sys/time.h>
"easy.h"
"multi.h"
"urlapi.h"
"options.h"
"header.h"
"websockets.h"
"mprintf.h"
"typecheck-gcc.h"
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\curlver.h
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\system.h
<ConditionalMacros.h>
<inttypes.h>
<inttypes.h>
<sys/types.h>
<sys/socket.h>
<sys/poll.h>
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\easy.h
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\multi.h
"curl.h"
1747048791 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\urlapi.h
"curl.h"
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\options.h
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\header.h
1747048791 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\websockets.h
1747048790 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\mprintf.h
<stdarg.h>
<stdio.h>
"curl.h"
1747048791 c:\users\yaros_tm2sc6p\Ðàáî÷èé ñòîë\cs-lab34\histogram\curl\include\curl\typecheck-gcc.h

@ -2,34 +2,44 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="text.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="text.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="339" topLine="0" />
<Cursor1 position="93" topLine="0" />
</Cursor>
</File>
<File name="histogram.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="histogram.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="843" topLine="0" />
<Cursor1 position="0" topLine="17" />
</Cursor>
</File>
<File name="histogram_internal.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="svg.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="116" topLine="0" />
<Cursor1 position="931" topLine="12" />
</Cursor>
</File>
<File name="text.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="text.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="93" topLine="0" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1632" topLine="55" />
</Cursor>
</File>
<File name="svg.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="323" topLine="0" />
</Cursor>
</File>
<File name="histogram.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="histogram_internal.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="205" topLine="0" />
<Cursor1 position="116" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="histogram.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="297" topLine="9" />
<Cursor1 position="33" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

Двоичные данные
Histogram/bin/Debug/Histogram.exe

Двоичный файл не отображается.

@ -1,6 +1,7 @@
#include "histogram.h"
#include <vector>
#include <algorithm>
#include <string>
#include "svg.h"
size_t find_minmax(const std::vector<double>& numbers, double& min, double& max) {
if (numbers.empty()) {
@ -27,34 +28,15 @@ std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bi
double min, max;
find_minmax(numbers, min, max);
if (max == min) {
return bins; // Âîçâðàùàåì ïóñòûå êîðçèíû, findòàê êàê ãèñòîãðàììà íå ìîæåò áûòü ïîñòðîåíà
return bins;
}
double bin_width = (max - min) / bin_count;
for (double number : numbers) {
size_t bin_index = static_cast<size_t>((number - min) / bin_width);
if (bin_index >= bin_count) {
bin_index = bin_count - 1; // Îáðàáîòêà êðàéíåãî ñëó÷àÿ max == number
bin_index = bin_count - 1;
}
bins[bin_index]++;
}
return bins;
};
void show_histogram_svg(const std::vector<size_t>& bins) {
const auto IMAGE_WIDTH = 400;
const auto IMAGE_HEIGHT = 300;
const auto TEXT_LEFT = 20;
const auto TEXT_BASELINE = 20;
const auto TEXT_WIDTH = 50;
const auto BIN_HEIGHT = 30;
const auto BLOCK_WIDTH = 10;
svg_begin(IMAGE_WIDTH, IMAGE_HEIGHT);
for (size_t i = 0; i < bins.size(); ++i) {
const double bin_width = BLOCK_WIDTH * bins[i];
const double top = i * BIN_HEIGHT;
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#aaffaa"); // Ïðèìåð öâåòà
}
svg_end();
}

@ -39,11 +39,9 @@ Input input_data(std::istream& in, bool prompt) {
using namespace std;
int main(int argc, char* argv[]) {
curl_global_init(CURL_GLOBAL_ALL);
if (argc>1){
cerr << "argc = " << argc << endl;
for (int i=0; i < argc; ++i){
cerr << "argv[" << i << "] = " << argv[i] << endl;
}
return 0;
}
Input in = input_data(std::cin, true);

Двоичные данные
Histogram/obj/Debug/main.o

Двоичный файл не отображается.

@ -1,6 +1,7 @@
#include "svg.h"
#include <iostream>
#include <string>
#include <vector>
void svg_begin(double width, double height) {
std::cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
@ -16,9 +17,30 @@ void svg_end() {
}
void svg_rect(double x, double y, double width, double height, std::string stroke, std::string fill) {
std::cout << "<rect x='" << x << "' y='" << y << "' width='" << width << "' height='" << height << "' stroke='" << stroke << "' fill='" << fill << "' />\n";
std::cout << "<rect x='" << x<< "' y='" << y << "' width='" << width << "' height='" << height << "' stroke='" << stroke << "' fill='" << fill << "' />\n";
}
void svg_text(double left, double baseline, std::string text) {
std::cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>\n";
}
void show_histogram_svg(const std::vector<size_t>& bins) {
const auto IMAGE_WIDTH = 400;
const auto IMAGE_HEIGHT = 300;
const auto TEXT_LEFT = 20;
const auto TEXT_BASELINE = 20;
const auto TEXT_WIDTH = 50;
const auto BIN_HEIGHT = 30;
const auto BLOCK_WIDTH = 10;
svg_begin(IMAGE_WIDTH, IMAGE_HEIGHT);
for (size_t i = 0; i < bins.size(); ++i) {
const double bin_width = BLOCK_WIDTH * bins[i];
const double top = i * BIN_HEIGHT;
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#aaffaa");
}
svg_end();
}

@ -7,3 +7,4 @@ void svg_begin(double width, double height);
void svg_end();
void svg_rect(double x, double y, double width, double height, std::string stroke = "black", std::string fill = "black");
void svg_text(double left, double baseline, std::string text);
void show_histogram_svg(const std::vector<size_t>& bins);

Двоичные данные
Histogram/svg.o

Двоичный файл не отображается.

@ -24,4 +24,7 @@ void show_histogram_text(const std::vector<size_t>& bins) {
}
std::cout << "\n";
}
}
};

Загрузка…
Отмена
Сохранить