Karan Joshi
Hello
PRIYANSHY
HLOo
Talula
When i want to run the code it says enviorment error
That is such a little information... which OS, which compiler, when are you getting the error...?
PRIYANSHY
hy
Anonymous
hy
its a bot
Anonymous
C supports gui?
Anonymous
In which field C is widely used?
Talula
C supports gui?
Yes it does...
Talula
In which field C is widely used?
Hmm... none actually... C++ is used widely in Embedded, Core Programming, Core Gaming Logic, System level programming, etc... C... hmm... can't think of anything.
Anunay
Linux ecosystem actually, not just the kernel
Don’t use \n\r in printf or use scanf(“line:%d”,&a);
It doesn't work, when i click enter it automatically goes down
Talula
You don’t want it to go down when you press enter?
Vikie
Hi
Talula
Yes
Then you have to use getch() and get each char till you get \n\r which you should ignore and not display.
Ok, thank you!
holin
Excuse me, may you all have a great day. I want to know is one of you understood or advanced in data structures such as linked list, stack, and queue in C language? Let me know please i need your help to finish my final project, thankyou 🙏🙂
holin
Sure
May i chat you privately? If you don't mind, there's 2 mini projects that'll need your help 🙏
holin
Yeah you can
Done, thanks ✨👍
vasu
guys, can anyone tell me how to use graphics.h in VSCode?
Hamid
hey everyone, to be honest, i'm very new to cpp but i coded in python, js, ... before what i'm trying to do is very simple. i wanna use someexternal libraries in "boost" library i read some articles about how to link my cpp code with external libraries, but i got some undefined refrence to error when i trying to compile the code example in the docs of boost library i use mingw with windows 10 64bit #CPP #mingw #external_library
Hamid
this is the code that i enter in the powershell to compile my reg.cxx program g++ C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-d-x32-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-s-x64-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-sd-x64-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-x64-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-d-x64-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-s-x32-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-sd-x32-1_68.a C:\mingw64\include\boost\lib\libboost_regex-mgw63-mt-x32-1_68.a .\reg.cxx -I C:\mingw64\include\boost\include\
Hamid
i also tried g++ -L <PathToBoostLibFolder> reg.cxx ... but didn't work { gave me undifined refrence to error
Hamid
this is the code example in boost docs: #include <iostream> #include <string> #include <boost/regex.hpp> using namespace std; int main() { string line; boost::regex pat( "^x.*" ); while (cin) { getline(cin, line); boost::smatch matches; if (boost::regex_match(line, matches, pat)) cout << matches[2] << endl; } cout << "im done!"; }
Andrew
in the boost folder there is an hpp file?
Hamid
in the boost folder there is an hpp file?
yep - there are a lots of hpp files in boost\include\
Andrew
try to show the output of the compile
Andrew
are you using codeblocks?
Hamid
are you using codeblocks?
no, i enter this commands manually - i use vscode
Hamid
https://gist.github.com/hamidb80/9b93e1219803d769177f8f5eb3ddd801
Andrew
oh i think i understand
Andrew
you may be missing the flags
Hamid
Do yiu have the compiled binaries of the libraries?
yeah - i guess .a files are compiled binaries. right?
Andrew
try adding this to the g++ command -lboost_regex
Hamid
try adding this to the g++ command -lboost_regex
it gives me this: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_regex collect2.exe: error: ld returned 1 exit status
Andrew
btw looking for your log, you also have to include the phtread lib
Hamid
try adding this -lboost_regex-gcc34-mt-d-1_36
it should find the libraries, right? but i have no idea what's going on C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_regex-mgw63-mt collect2.exe: error: ld returned 1 exit status here's the code g++ -IC:\mingw64\include\boost\include\ -LC:\mingw64\include\boost\lib\ -lboost_regex-mgw63-mt .\reg.cxx
Sabuhi
Hello
Sabuhi
#include <iostream> #include <vector> int main () { std::vector<int>::size_type sz; std::vector<int> foo; sz = foo.capacity(); std::cout << "making foo grow:\n"; for (int i=0; i<100; ++i) { foo.push_back(i); if (sz!=foo.capacity()) { sz = foo.capacity(); std::cout << "capacity changed: " << sz << '\n'; } } std::vector<int> bar; sz = bar.capacity(); bar.reserve(100); // this is the only difference with foo above std::cout << "making bar grow:\n"; for (int i=0; i<100; ++i) { bar.push_back(i); if (sz!=bar.capacity()) { sz = bar.capacity(); std::cout << "capacity changed: " << sz << '\n'; } } return 0; }
Sabuhi
Can anyone help me? Why in this code capacity is incresased by 2 by 2.
Serhat
/get
Sabuhi
Capacity incresased as powers of 2
Serhat
/get
Serhat
/get cbook
Pavel
Can anyone help me? Why in this code capacity is incresased by 2 by 2.
https://stackoverflow.com/questions/5232198/about-vectors-growth
Pavel
Can anyone help me?
Long story short, to reduce allocations count
Ali
i also tried g++ -L <PathToBoostLibFolder> reg.cxx ... but didn't work { gave me undifined refrence to error
Are you able to run any program which includes boost? I am able to compile and run with following command g++ -O3 -g3 -std=c++17 -Wall -Wextra -Werror -I D:/cpp/boost/include/boost-1_75 -o main main.cpp
Sherlock
I don't understand how both the operands get their value in an operator overloading please explain?
Sherlock
I don't understand how both the operands get their value in an operator overloading please explain?
If I see the syntax, the only one argument is passed so that means it shouldn't get the other value anyhow
Anonymous
i did
Then it's invalid. Simple
Anonymous
Hi👋 I want to learn about OS programming with C and Assembly. What is best books for this?
Ali
use cmake for simplicity
I too started learning C++ recently and saw many projects use cmake. Will definitely use cmake in coming days.
Ali
Am bit familiar with Makefile, not sure why cmake is popular with C++
Sherlock
??
Hamid
Are you able to run any program which includes boost? I am able to compile and run with following command g++ -O3 -g3 -std=c++17 -Wall -Wextra -Werror -I D:/cpp/boost/include/boost-1_75 -o main main.cpp
g++ -IC:\mingw64\include\boost\include\ -LC:\mingw64\include\boost\lib\ -lboost_regex -O3 -g3 -std=c++17 -Wall -Wextra -Werror .\reg.cxx result: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_regex collect2.exe: error: ld returned 1 exit status
**
Needed a help in writing a program to add one digit to a 4 digit number and *ignore the carry digit*
Anonymous
Hello
Anonymous
I have a code where I'm having trouble with
Anonymous
#define _USE_MATHS_DEFINES #include<cmath> #include<iostream> using namespace std; int main() { //M_PI=3.1415926536 double radius,circumference,area; char normal; cout<<"Enter desired radius"<<endl; cin>>radius; cout<<"Enter desired objective. choose from either circumference or area\n"; cin>>normal; switch(normal) { case 'circumference': circumference=double(normal); cout<<"The answer is\n"<<radius*M_PI*2; break; case 'area': area=double(normal); cout<<"The answer is\n"<<radius*M_PI*M_PI; break; default: cout<<"Don't know how to help you. Sorry!"<<endl; break; } return 0;
Anonymous
It won't work the way I'm intending
Hamid
It won't work the way I'm intending
What do you want from this code?
Anonymous
It prints my default case
Anonymous
All the time
Hamid
It prints my default case
If code inside a case was more than one line