User forums > Using Code::Blocks

including multiple file

(1/1)

Aristotle:
I created five files :main.cpp, c++_1.cpp,c++_1.h,c++_2.h,c++_2.cpp; c++_1.cpp have c_1() function and c++_2.cpp have c_2() function, after including all the file in the same directory  I called the two function c_1() and c_2() from main I could call c_1() individually but if I include c_2() there is an error message   
 
E:\codeblockprograms\c++ program\main.cpp           error:                             'c_2' was not declared in this scope|
||=== Build finished: 1 errors (0 minutes, 0 seconds) ===|

I am confused, any help please

BlueHazzard:
1. This is no c::b related question, but a general c++ question, so this is the wrong forum...
2. pls make your question a bit more clearer...
for example list all files and add the code like this:
main.cpp:

--- Code: ---#include "c++_1.h"
--- End code ---

c++_2.cpp:

--- Code: ---c_1()
{}

--- End code ---

etc...

3. Don't use special characters (like ++ ) in your path/file names this will cause problems...

greetings

Navigation

[0] Message Index

Go to full version