Code::Blocks Forums
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
As usual while waiting for the next release - don't forget to check the
nightly builds
in the forum.
Home
Help
Search
Login
Register
Code::Blocks Forums
»
User forums
»
General (but related to Code::Blocks)
»
CodeBlock does't detect non main source file
« previous
next »
Send this topic
Print
Pages: [
1
]
Go Down
Author
Topic: CodeBlock does't detect non main source file (Read 6188 times)
reemassam14
Single posting newcomer
Posts: 2
CodeBlock does't detect non main source file
«
on:
April 26, 2015, 06:15:54 am »
I build 3 files main.cpp , head.h and head.cpp.
main.cpp===>>
#include <iostream>
#include "head.h"
using namespace std;
int main()
{
show();
return 0;
}
head.h===>>
#ifndef HEAD_H_INCLUDED
#define HEAD_H_INCLUDED
void show();
#endif // HEAD_H_INCLUDED
head.cpp===>
#include <iostream>
#include "head.h"
using std::cout;
void show()
{
cout<<"Hello world!!";
}
-----------------------------------------------------------------------------
simple program to illustrate my problem. Whenever i run this program i get an error saying
in function main undefine refernce to show()
--------------------------------------------------------------------------
any solution to configure my CodeBlock..
--------------------------------------------------------------------------
it is working only when i include head.cpp in head.h . and i don't want to do that .plzzz help
Logged
MortenMacFly
Administrator
Lives here!
Posts: 9694
Re: CodeBlock does't detect non main source file
«
Reply #1 on:
April 26, 2015, 06:25:37 am »
Create a project, add all files, hit compile. Don't do a single file compilation. Inspect the C::B manual to see how to do so.
Next time, please don't do multiple posts with the same content. I've removed the other.
Logged
Compiler logging
: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual
:
https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ
:
https://wiki.codeblocks.org/index.php?title=FAQ
reemassam14
Single posting newcomer
Posts: 2
Re: CodeBlock does't detect non main source file
«
Reply #2 on:
April 26, 2015, 07:13:01 am »
Still not working... same error in main undefine refence to show()
Logged
MortenMacFly
Administrator
Lives here!
Posts: 9694
Re: CodeBlock does't detect non main source file
«
Reply #3 on:
April 26, 2015, 08:59:17 am »
Sorry, but I cannot believe this.
I've attached the project that works just fine.
Next time, please be more clear what EXACTLY you do, on what platform, what version, what compiler etc...
Logged
Compiler logging
: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual
:
https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ
:
https://wiki.codeblocks.org/index.php?title=FAQ
Send this topic
Print
Pages: [
1
]
Go Up
« previous
next »
Code::Blocks Forums
»
User forums
»
General (but related to Code::Blocks)
»
CodeBlock does't detect non main source file