When trying to run my C++ project in VS2017, I'm finding myself unable to build out my project. The specific error I'm getting is
Code: LNK1104 Description: cannot open file 'sfml-window-d.lib'.
When setting up SFML, I referenced the startup file on your site and this tutorial (
). I believe my code is alright, and I'll include it below, so I imagine I'm messing up with how I set up my linker.
Here's an Imgur album with screenshots of my folder setup and Properties window with the linker and whatnot: (
https://imgur.com/a/pmDrZm3). I can add more screenshots if there's something you'd like to see that's missing.
As for the code, I don't think it's the issue here, but here it is:
#include <SFML/Graphics.hpp>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
using namespace sf;
double RED_COEFF = 0.2125;
double GREEN_COEFF = 0.7154;
double BLUE_COEFF = 0.0721;
char getCorrespondingAsciiChar(int grayScale, string among) {
return among[(int)(grayScale / 255.f*among.size())];
}
int main() {
int Xresolution;
string path;
string outputPath;
string customChar;
string among = "@%#Oo*+=-:. ";
cout << "JPG to ASCII Converter" << endl << "by XXXXX XXXXXXX for XXXXXX" << endl;
cout << endl << "Input the path of the image you want ot convert: ";
cin >> path;
cout << endl << "Input the output path for the ASCII art: ";
cin >> outputPath;
cout << endl << "How many pixels will one ASCII character represent? ";
cin >> Xresolution;
Image image;
image.loadFromFile(path);
Image bwImage(image);
//Conversion from Regular to Grayscale
for (int i = 0; i < image.getSize().x; i++) {
for (int j = 0; j < image.getSize().y; j++) {
bwImage.setPixel(i, j, Color::Color(image.getPixel(i, j).r*RED_COEFF + image.getPixel(i, j).g*GREEN_COEFF + image.getPixel(i, j).b*BLUE_COEFF, image.getPixel(i, j).r*RED_COEFF + image.getPixel(i, j).g*GREEN_COEFF + image.getPixel(i, j).b*BLUE_COEFF, image.getPixel(i, j).r*RED_COEFF + image.getPixel(i, j).g*GREEN_COEFF + image.getPixel(i, j).b*BLUE_COEFF));
}
}
//Conversion from Grayscale to Down Resolution
int Yresolution = 2 * Xresolution;
Image bwLowResImage(image);
int grey = 0;
for (int i = 0; i < image.getSize().x; i += Xresolution) {
for (int j = 0; j < image.getSize().y; j += Yresolution) {
for (int x = 0; x < Xresolution; x++) {
for (int y = 0; y < Yresolution; y++) {
grey += bwImage.getPixel(i + x, j + y).r;
}
}
grey /= Xresolution * Yresolution + 1;
for (int x = 0; x < Xresolution; x++) {
for (int y = 0; y < Yresolution; y++) {
bwLowResImage.setPixel(i + x, j + y, Color::Color(grey, grey, grey));
}
}
}
}
//Conversion from Down Resolution to ASCII
string asciiArt;
int lol = 0;
for (int j = 0; j < bwLowResImage.getSize().y; j += Yresolution) {
for (int i = 0; i < bwLowResImage.getSize().x; i += Xresolution) {
asciiArt += getCorrespondingAsciiChar(bwLowResImage.getPixel(i, j).r, among);
}
asciiArt += "\n";
lol++;
}
ofstream output(outputPath);
cout << "Conversion complete. ASCII art file can befound as: " << outputPath;
cin.get();
cin.get();
return 0;
}
Thanks for any help you might be able to provide. I'm pulling my hair out here.