hs2361 / k-means-compressor

k means clustering based image compression algorithm project for OOPL
6 stars 8 forks source link

[FEATURE] Remove bits/stdc++.h #4

Closed DebadityaPal closed 3 years ago

DebadityaPal commented 3 years ago

The bits/stdc++.h header file used is a nonstandard header file that might not work with non-GNU compilers like Clang. Hence, we should get rid of it. Try to import the header dependencies individually and remove all instances of bits/stdc++.h

XDRAGON2002 commented 3 years ago

I would like to work on this issue

DebadityaPal commented 3 years ago

Assigned. Feel free to contact either of us if you need some help.

XDRAGON2002 commented 3 years ago

I can't seem to get the program to even compile even though I have gcc version 11.1.0. So could I be provided with an example command that is guaranteed to run without throwing any errors ?

EDIT -

  1. For some reason, the gcc compiler could not link the files properly and threw collect2.exe error, whereas the g++ compiler worked flawlessly.
  2. Also, the documentation for compiling also contained a syntactical error - gcc -std=C++17 compressor.cpp (did not work) g++ -std=c++17 compressor.cpp (this worked, notice that instead of C++ its c++)
DebadityaPal commented 3 years ago

Send the error traceback. It makes it easier for us to figure out the error. Also did you set the C++17 flag, like this? gcc -std=C++17 compressor.cpp <args>

XDRAGON2002 commented 3 years ago

I've edited my previous comment, do check it out.

DebadityaPal commented 3 years ago

Tagging @hs2361 for visibility. @XDRAGON2002, try using g++ -std=c++17 compressor.cpp -o compressor. There is a documentation error indeed, if you want you can update it in the docs as well, otherwise, I'll do it. Feel free to raise an issue.

XDRAGON2002 commented 3 years ago

@DebadityaPal yes the updated command works as expected, I'll be sure to raise and fix the documentation issue once I'm finished with this issue. Also just for the sake of it, any idea why the gcc compiler might behave this way ? Not being able to link files ?

DebadityaPal commented 3 years ago

So the gcc compiler is basically a simplified version of the g++ compiler. In simple terms: g++ = gcc -xc++ -lstdc++ -shared-libgcc where the first arg is a compiler and the other 2 are linkers. Check out this Stackoverflow Question for a much more detailed answer

XDRAGON2002 commented 3 years ago

Oh okay that explains a lot. Thanks for the quick response though !

XDRAGON2002 commented 3 years ago

Also created #8 regarding the documentation fix.

DebadityaPal commented 3 years ago

No problem, but unfortunately I can't add that issue to the hacktoberfest topic as it is a very small issue. I'm afraid their reviewers would mark it as spam. But it would count towards the Git Init FOSS leaderboard though.

XDRAGON2002 commented 3 years ago

Sure, it's okay.

XDRAGON2002 commented 3 years ago

Opened PR #9 fixing this issue.