Talula
Should I start arguing?
Abhishek
For the past couple of days I've been trying get a basic OpenGL application running. I using Windows (Do not wish to use Linux or MacOS) My project is written in C++ and uses the following libraries (I am using the pre-compiled binaries): GLFW GLEW PS: I want to use these libraries specifically and as statically linked I am using GCC (MinGW) and CMake (I do not wish to use Visual Studio) So far I've been getting one compiler error after another. I've been wracking my brain for the past 3 days. My current compiler stack trace says: CMakeFiles\opengl_practice.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x8e): undefined reference to `__imp_glClear' My Project structure: opengl_practice +---libraries | +---glew | | +---bin | | | +---Win32 | | | | glew32.dll | | | | | | | \---x64 | | | glew32.dll | | | | | +---include | | | \---GL | | | eglew.h | | | glew.h | | | glxew.h | | | wglew.h | | | | | \---lib | | +---Win32 | | | glew32.lib | | | glew32s.lib | | | | | \---x64 | | glew32.lib | | glew32s.lib | | | \---glfw | +---include | | \---GLFW | | glfw3.h | | glfw3native.h | | | \---lib | \---x64 | glfw3.dll | libglfw3.a | libglfw3dll.a | \---sources | main.cpp | \---include
klimi
main.cpp: https://pastebin.pl/view/befd9c2c CMakeLists.txt: https://pastebin.pl/view/9ee74d0c build.bat: https://pastebin.pl/view/87045bc3
klimi
little tip, if you are making some project, having it on github or gitlab will be more comfortable for sharing
klimi
yeah, as far as the actuall problem, when i was working with glew and glfw it was quite painful to get all the deps together and i did it on linux... on windows it might be even worse
Abhishek
As far as I've read on the internet, I have the necessary files. I think there are some mistakes that I've made in my CMakeLists.txt file I tried many things but I can't seem to get it right.
klimi
https://github.com/andystanton/glfw-skeleton you can try looking at this skeleton
Abhishek
Okay let me take a look
klimi
or you can even use it as a skeleton
klimi
while cloning dont forget to clone submodules too
Abhishek
This version downloads the sources from Github and compiles them with the project What I was trying to do was to use the precompiled binaries which I already have in my project
Abhishek
I just tried removing all of the GLEW commands and it compiled and executed successfully. Which proves that the issue is with GLEW and not GLFW
klimi
i havent experimented with precompiled libs...
Yahollipaaa✨🪐
hello everyone, can anyone help me
Yahollipaaa✨🪐
Given an n-digit number (n> = 2). Calculate the number of repetitions of a given digit in the number c++
Yahollipaaa✨🪐
I'm just a beginner and don't understand how to write it yet
z
I'm just a beginner and don't understand how to write it yet
https://www.cplusplus.com/reference/string/to_string/
Yahollipaaa✨🪐
What is it?
Pavel
Hashmap is overkill, there are just 10 digits, you can use std::array<int, 10> to count how many times a digit appeared
z
What is it?
to_string function to convert integer to string. And then you can iterate the string, char by char.
z
Though, I think if you divide and mod by 10 can be more efficient.
Talula
What is it?
Convert the number to string and then search the string for the repetition of the given number.
Anonymous
C++ Coding is hard to learn?
Talula
C++ Coding is hard to learn?
No... but depends on what you want to do with it.
Hanz
C++ Coding is hard to learn?
When you thought so
Anonymous
Hanz
now he's PMing me, why
Abhishek
i havent experimented with precompiled libs...
I am using GL3W now... I am compiling the generated source using CMake into a library and linking it with target_link_libraries I am getting these linker errors: CMakeFiles\opengl_practice.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xaa): undefined reference to `gl3wInit' CMakeFiles\opengl_practice.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xcc): undefined reference to `gl3wIsSupported' CMakeFiles\opengl_practice.dir/objects.a(main.cpp.obj):main.cpp:(.rdata$.refptr.gl3wProcs[.refptr.gl3wProcs]+0x0): undefined reference to `gl3wProcs'
klimi
Havent used that
Abhishek
This is a CMake issue
Abhishek
I was wondering what could be the porblem
Abhishek
shall I paste the CMake lines for gl3w?
Abhishek
5 lines?
Hanz
0
Dima
lmao
Dima
retarded bot
B121065_Swoyam Siddharth Nayak
but s2 is greater than s1
Hanz
but compare is compare
B121065_Swoyam Siddharth Nayak
it shows -ve when first string is smaller than the other na
Hanz
??
Hanz
Compare strings (std::string::compare) Compares the value of the string object (or a substring) to the sequence of characters specified by its arguments. The compared string is the value of the string object or -if the signature used has a pos and a len parameters- the substring that begins at its character in position pos and spans len characters. This string is compared to a comparing string, which is determined by the other arguments passed to the function.
B121065_Swoyam Siddharth Nayak
#include <iostream> #include <string> using namespace std; int main(){ string s1="xyz"; string s2="wxyz"; cout<<s2. compare(s1); return 0; }
B121065_Swoyam Siddharth Nayak
what should be the output of the above snippet
Hanz
Return Value Returns a signed integral indicating the relation between the strings: 0 They compare equal <0 Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter. >0 Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.
B121065_Swoyam Siddharth Nayak
okay, means it is comparing the first character ri8?
Hanz
comparing STARTS FROM the first character
B121065_Swoyam Siddharth Nayak
w < x thats why it is giving output as -1
B121065_Swoyam Siddharth Nayak
yyup yyup thanks buddy
Hanz
yeah, that is true
Ni
guys i have a question: char str[5] = "Hello"; should this illegal? cause the array str could only hold 5 characters, while the string has 6.
Ni
I know "Hello" has 6 characters, so you mean the str could hold 6 characters?
Ni
while i run this code: char str[5] = "Hello"; puts(str); shows no error, not even a warning
Anonymous
now he's PMing me, why
Send proof to ot, I'll warn him
Anonymous
#ot
Ni
thanks
Anonymous
Yes, you need approval Send me to PM
Ehsan
I like these messages always makes me die😭😂😂😂
olli
while i run this code: char str[5] = "Hello"; puts(str); shows no error, not even a warning
C and C++ differ when it comes to this initialization. In C this is basically char str[] = { 'H', 'e', 'l', 'l', 'o' }; and legal because the null terminator might be omitted (n1570, 6.7.9.14). From Example 8 (6.7.9.32) The declaration char s[] = "abc", t[3] = "abc"; defines ``plain'' char array objects s and t whose elements are initialized with character string literals. This declaration is identical to char s[] = { 'a', 'b', 'c', '\0' }, t[] = { 'a', 'b', 'c' }; In C++ this is just illegal as dcl.init#string-2 states: "There shall not be more initializers than there are array elements."
Ni
Thank for sharing the answer, it really helps
Anonymous
/warn no English
Anonymous
/ban 741763329
.
/ban
Anonymous
Hello
Anonymous
Maybe someone did this exercise and can share? 😊 https://www.chegg.com/homework-help/questions-and-answers/c-write-program-following-loads-username-password-sets-file-passwordtxt-insert-hash-table--q18592922