Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Aristotle on July 21, 2013, 10:38:58 am

Title: including multiple file
Post by: Aristotle on July 21, 2013, 10:38:58 am
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
Title: Re: including multiple file
Post by: BlueHazzard on July 21, 2013, 05:46:33 pm
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"

c++_2.cpp:
Code
c_1()
{}

etc...

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

greetings