C++ Programming Tutorial 96 - Class Across Files - Multifile Compilation

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

Class across files? I certainly think that you have it, as all of these videos have been superb! Thanks again for making them, and I completely intend to start another tutorial series (possibly Java or Python) immediately once I finish this one...

PunmasterSTP
Автор

I know this is a debatable issue, but I have to ask: Is it best to put all #include statements in the header file, or have them in the .cpp files?
In my example, I need <iostream, vector, and string> includes in both my main and class .cpp files, and I need <string> in my header file. Is it not better to just put all the includes in the header file instead of having them in both my cpp files as well as one in my header file? Maybe this is my C programming habits coming out! Thx...Ian

ianq
Автор

You could also use _#pragma__ once_ instead of the #ifndef magic words.

Cobalt
Автор

How about if you have a class that needs to inlcude another class?

I've got an Organizer class that needs to be initiated with an array of Slot's. It doesn't like it when I include Slot from main ("Slot is not a type name") or if I don't ("Expected initializer before allSlots").

userthatsme
Автор

I use xcode. Anyone know how to resolve the following error? "2 duplicate symbols for architecture x86_64"
I have a main.cpp, 2 .cpp + 2 .h files for class declarations & definitions, and 1 .h for enumeration. Any insight is appreciated! Thanks!

RudyGOfficial
Автор

Do you generally not use the key word "class" or class name in the .cpp file when you separate it from the declaration .h file? Just definitions and declarations in separate files?

n.g.
Автор

1:42 .h contains the declaration class_name.cpp contains the definition. Thanks

jaimecarranza
Автор

I need help. Are 2 days I'm trying to repeating this exercise, but it doesn't compile. Is the written code available?

donato
Автор

still hard to understand why "static" is deleted... can anyone explain about it?

cafelashowerezweb
Автор

I prefer creating a makefile for multiple file compilation. But I have a problem with debugging. It throws an error like "undefined reference" . If I include the implementation file(.cpp) in main.cpp, then the problem goes away. But I want to know if there is another way to fix this. Can you help me ?

TheMessinho
Автор

how to implement templated class sepration ???

mayankk
Автор

me coming from java where we can just say "import {class name here}"; and be done...

JVenom_
Автор

69 lines and it's the 96th episode ;)

Jackaldev
Автор

That's very time consuming. python and java is generates these files. I didn't c++ was this bad

basicallybrand
Автор

Hehe "big 69 line code" 69 nice

dimitardime