•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 425,895 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,931 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 269 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Hello,
I'm trying to make a code that acts as a simple menu for a number of programs. What I was wondering was how do I include the .ccp files and run them in the menu program. Here's what I have so far:
I've placed all the files in the same folder and also created a project. I also tried putting the full file name for each file but I kept getting the same error:
Any help will be greatly appreciated.
I'm trying to make a code that acts as a simple menu for a number of programs. What I was wondering was how do I include the .ccp files and run them in the menu program. Here's what I have so far:
#include <stdio.h>
#include <stdlib.h>
#include "1.cpp"
#include "2.cpp"
#include "3.cpp"
#include "4.cpp"
int main()
{
int select;
printf("Assignments\n");
printf("-----------\n\n");
printf("1. Multiple of 5\n2. Calculator\n3. Rock, Paper, Scissors\n4. No Vowels (incomplete)\n7. Exit\n");
scanf(" %d", &select);
switch(select)
{
case 1:
a1();
break;
case 2:
a2();
break;
case 3:
a3();
break;
case 4:
a4();
break;
default:
printf("That's not a choice.\n");
break;
}
system("PAUSE");
return 0;
}I've placed all the files in the same folder and also created a project. I also tried putting the full file name for each file but I kept getting the same error:
multiple definition of `a1()' or a2(), etc...Any help will be greatly appreciated.
http://faq.cprogramming.com/cgi-bin/...&id=1043284392
Same principle for C
You separate the implementation (in a .c file) from the interface (in a .h).
Everything else includes just the interface, and the implementation is in just one place.
Also, stop calling your C programs with a .cpp extension. That will just lead you astray.
Same principle for C
You separate the implementation (in a .c file) from the interface (in a .h).
Everything else includes just the interface, and the implementation is in just one place.
Also, stop calling your C programs with a .cpp extension. That will just lead you astray.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
•
•
Join Date: Jun 2008
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks for your help guys. I figured it out using this link: http://faq.cprogramming.com/cgi-bin/...&id=1043284392. Here's the code that I ended up with:
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
int main(void)
{
int select;
printf("Assignments\n");
printf("-----------\n\n");
printf("1. Multiple of 5\n2. Calculator\n3. Rock, Paper, Scissors\n4. No Vowels (incomplete)\n7. Exit\n");
scanf(" %d", &select);
switch(select)
{
case 1:
spawnl( P_OVERLAY, "1.exe",
"1.exe", "1.exe", "Arg1", "Arg2", NULL );
break;
case 2:
spawnl( P_OVERLAY, "2.exe",
"2.exe", "2.exe", "Arg1", "Arg2", NULL );
break;
case 3:
spawnl( P_OVERLAY, "3.exe",
"3.exe", "3.exe", "Arg1", "Arg2", NULL );
break;
case 4:
spawnl( P_OVERLAY, "4.exe",
"4.exe", "4.exe", "Arg1", "Arg2", NULL );
break;
case 7:
break;
default:
printf("That's not a choice.\n");
break;
}
return 0;
}![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Including external files in the program (C++)
- Including files at run time (C)
- problem with including files (C++)
- help with my computer files (Viruses, Spyware and other Nasties)
- Cannot open certain websites, including hotmail (Web Browsers)
- Why To include Header Files in Cpp and Not in C Language (C++)
Other Threads in the C Forum
- Previous Thread: msgsnd call hangs
- Next Thread: Use of strtok



Linear Mode