Oleg
it gives `multiple definition of f123`
Oleg
I know if I move defenition in cpp file it will work, but why it doesn't work if it is in h-file
Oleg
it's why #ifndef is made for...
Dima
You have to make it inline or define the function in a separate cxx file
Oleg
You have to make it inline or define the function in a separate cxx file
yes, I know, but why it doesn't work in h-file, #ifndef should prevent "multiple definition", right?
Pavel
yes, I know, but why it doesn't work in h-file, #ifndef should prevent "multiple definition", right?
Ifdefs work in a translation unit. You probably have many of them in your app
Oleg
Ifdefs work in a translation unit. You probably have many of them in your app
if you mean "source file" - yes, but it also should work in h-file
Pavel
if you mean "source file" - yes, but it also should work in h-file
Not exactly. I go with big simplification, because compilers nowadays doing some smarter things but the idea is the same. Imagine your program as a group of cpp files where everything that is #included is actually included in them. Some headers can be included twice but then include guards will disable duplicated code. Each that thing is a translation unit. You have several translation units that are compiled each in an object file (if I correct with naming). Then you have linker that will link code that calls with code that define what is called. And there you have a problem when you have definitions in header files, because you have many definitions of one thing.
Pavel
And in reality these definitions can be different so it's not safe to take just random one
Priori
Can anyone here teach me C program and c++
Priori
?
BinaryByter
#personal_trainer
BinaryByter
fuck rose is broken
Dima
Wim
fuck rose is broken
Wtf did you do to her?
BinaryByter
Wtf did you do to her?
You'll see next time you open your favourite website ^^
Ainu_r
Do i request pdf for educational purpose
BinaryByter
/ban
Damien
Hey, need to create wsdl file for the soap web service but I dunno how and what to use for that. I need something like wsdl editor with design mode and etc. but I didn't find any open source apps. Thanks in advance.
Anonymous
structure padding and so on
Structure padding is allocation of more data than mentioned in a structure is that correct?
Anonymous
I don't understand why this happens
Anonymous
Hai im system information student, nice to meet you all
german oak
hola
Anonymous
.
Joe
Who’s good in sorting arrays?
Wim
*starts headbanging*
Dima
*starts headbanging*
( ͡° ͜ʖ ͡°)
Francisco
Who’s good in sorting arrays?
A computer with a good algorithm
Anonymous
*starts headbanging*
*raining blood*
Francisco
Good then not you
I've coded more sorting algorithms than you can think, don't judge so quickly
Dima
I've coded more sorting algorithms than you can think, don't judge so quickly
Just like your algorithms, won’t judge quickly ( ͡° ͜ʖ ͡°)
Dima
Anonymous
Please tell me about friend function in C++
klimi
Please tell me about friend function in C++
Friend function is a function that makes friends
klimi
It takes 2 uid as parameters and outputs social.life.relationships.status
Dima
It allows you to instantiate classless function/operator which can be applied to these two classes/structs
Wim
Friend function is a function that makes friends
Is there a fornicate function over that too?
Dima
I think he meant an operator
Wim
So if you have the relationshipstatus, would that trigger a divorce when both are married or won't the compiler figure out they're cheating?
Wim
Can they have kids?
Anonymous
Hi
Anonymous
I have a question, how does windows c++ implement process hiding and port hiding?
Anonymous
I found out that Google searched a lot of information, and did not find any related functions/APIs that could implement Windows process hiding, port hiding, or port multiplexing communication.
Anonymous
I hope that friends who know this technology can help me to provide some information for me to study.
Dima
I like your profile pic
Anonymous
If I can provide some relevant information, I will not be grateful. I searched for related technical cases on github and did not find it. If you can tell me the research direction in related fields, I will go deeper and understand.
Anonymous
Anonymous
I like your profile pic
Have you ever understood the technical details in my question?
professor
I am trying to generate a key from a given functions made by me, but I want to add randomize algorim without repetition similar as I do in python using secrets , but how can I do it in c++? my variable seq which store one , two , three, four , but once I want to concatenate my functions to generate my key if I change to std::vector<std::string my t it return an error of std::basic t = string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation key = ''.join([secrets.choice(t) for _ in range(20)]) int main(){ std::vector<std::string> seq{ "One", "Two", "Three", "Four" }; std::string t = reverse.ascii_lowercase() + reverse.ascii_uppercase() + reverse.digits() + reverse.punctuation(); std::cout << reverse.join(seq, "--") << std::endl; std::cin.get(); }
Anonymous
Who knows the technical details?
Joe
Ask Nobody help here anw 😂
BinaryByter
*starts headbanging*
here, use this mat, will allow for less pain when headbanging
BinaryByter
alternatively, quit the internet
BinaryByter
will reduce the amount of headbanging
BinaryByter
(please give me your postal adress first tho 😂)
Wim
here, use this mat, will allow for less pain when headbanging
I have taken special measures... Or atleast my religion did... So don't worry
🐰🐾 سمیه
/* conddetab.c : Extend entab and detab to accept the shorthand entab -m +n to mean tab stops every n columns; starting at column m. choose a convenient (for the user) default behaviour */
🐰🐾 سمیه
what does this part mean: tab stops ... it means tab is allowed, or removed ?
Anonymous
Can you guys suggest some good websites for coding competitions 😁
Ainu_r
Have 4G internet access for super sim pls anwer me
Anonymous
Code chef
thanks👍😁
professor
I am trying to generate my key random and joining a few hyphen after the key , but however when I try to do this I got no suitable user-defined conversion from "std::vector<std::string, std::allocator<std::string>>" to "std::string" on the other hand how can I include srand(time(NULL)); instead of declaring them every time on main . is will possible to include it on my random function? typedef unsigned int uint; std::string randomString(uint length, std::string string){ std::vector<uint> indexesOfRandomChars(length); // array of random values that will be used to iterate through random indexes of 'charIndex' for (uint i = 0; i < length; ++i) // assigns a random number to each index of "indexesOfRandomChars" indexesOfRandomChars[i] = rand() % string.length(); std::string key = ""; // random string that will be returned by this function for (uint i = 0; i < length; ++i)// appends a random amount of random characters to "randomString" { key += string[indexesOfRandomChars[i]]; } return key; } int main() { srand(time(NULL)); std::vector<std::string> t{ reverse.ascii_lowercase() , reverse.ascii_uppercase() , reverse.digits() , reverse.punctuation() }; std::cout << reverse.join(randomString(15, t), "--") << std::endl; std::cin.get(); }
Anonymous
/warns
Shubh
Has anyone worked with AVR or ARM ?
professor
did you get myRand?
Pavel
Which one do you prefer: typedef some_long_declaration alias; Or using alias = some_long_declaration; ?
Anmol
Does Anyone know qt c++?
professor
still the same problem I cannot use it like this std::cout << reverse.join(randomString(15, t), "--") << std::endl;
professor
I cannot send it as std string because join function it will break. how can I send it to randomstring into one?
professor
using my login
professor
what does join do is to join 2 strings of the iterable
professor
I got the same ` std::cout << reverse.join(randomString(20, std::accumulate(std::begin(t), std::end(t), std::string())), "--") << std::endl; ` error std:string to const vector
professor