User forums > General (but related to Code::Blocks)
compiling two differnt targets that have a main function
(1/1)
mak:
Hello
I searched all over this site and google to find an answer to this, but still no luck.
Basically I have two files I want to compile osmain.cc and kbrd.cc:
osmain.cc has the int main(){} function and
kbrd.cc has the main(){} function
they are both assigned to different targets, but are suppose to work together
they are both infinite while loops until ctrl-c is typed on the keyboard
When I build each target like osmain.cc, it complains about functions in kbrd.cc.
How can I compile/build these functions so it works???
stahta01:
Do NOT have them in each other targets.
If you turn on FULL compiler logging; I will bet they are both in both targets or you are linking them together.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Tim S.
mak:
Basically this piece of code doesn't execute in Code::Block
--- Code: ---in_pid = fork(); <--------- doesn't work
if (in_pid == 0) // is this the child process ?
{
execl("keyboard", "keyboard", childarg, 0); <---------- doesn't execute the other main in keyboard.cc
//getchar();
// should never reach here
fprintf(stderr,"osmain: can't exec keyboard, errno %d\n",errno);
//getchar();
cleanup();
//getchar();
exit(1);
}
--- End code ---
the second target assigned to keyboard.cc is keyboard, so why can't this main call the child process?
Jenna:
Please explain, why you think this problem is C::B related !
Don't forget, that C::B is an IDE, not a compiler !!
If it is not related to C::B, your post violates our forum rules and should be asked in a general programming forum, not in our forum / on our site.
Navigation
[0] Message Index
Go to full version