Message from C, C++ talks

June 2019

— Because they write small program in C/C++ now a days.

— So it doesn't make sense to have a seperate .h file for main.

— You mean students?🤔

— Or whereever your main is implimented.


There is one libssh library that is needed in .cpp implementation file, but not in .h file. Ideally, where should I put it?

— Assuming your program is called main.c or main.cpp your .h file will be main.h

— In your main,c or main.cpp you simply add #include "main.h"

— And your main,h includes every other .h file you want to include.

— It's sshConn.cpp and sshConn.h.
Main.c will use sshConn.h

— Is this a general convention or a personal opinion

— .cpp

— Do not place #include in header if it's not neccessary

— Include every .h in sshConn.h and in sshConn.cpp include sshConn.h

— Tazmikar ilayja you guys are contradicting each other

— I'm answering your question, which was "Can I place all the .h files in a seperate file and call that .h file"...

Message permanent page