Mix different C source files into a single one

H

Horacius ReX

Hi,

I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.

Do you know about some program able to do this kind of task ?

Thanks
 
M

Malcolm McLean

Horacius ReX said:
I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.

Do you know about some program able to do this kind of task ?
I do not believe this for one minute. Try compiling to object files and then
linking by hand.

However, on the offchance that you are correct, set up a file named main.c
which consists of

#include "file1.c"
#include "file2.c"
#include "file3.c"

and invoke the compiler on it. You might have to resolve some static
namespace clashes.
 
M

Mark McIntyre

Hi,

I have a C program split into different source files. I am trying a new
compiler and for some reason it only accepts a single source file. So I
need to "mix" all my different C source files into a single one.

That sounds /very/ unlikely. I suggest you need to read the documentation
again. For example most compilers will accept input along the lines of
cc file1.c file2.c file3.c
Do you know about some program able to do this kind of task ?

cat, or, if you're windows bound, copy.

Sorting out the resulting mishmash is a job normally left to the
programmer I'm afraid.
 
I

Ivan Novick

Hi,

I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.

Do you know about some program able to do this kind of task ?

Thanks

Which compiler? Which platform?

Regards,
Ivan Novick
http://www.0x4849.net
 
C

CBFalconer

Horacius said:
I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.

Do you know about some program able to do this kind of task ?

I think you should dump that 'new compiler' very quickly. If it
can't handle a #include statement, it does not come anywhere near
meeting any standard. I shudder to think what else is missing.
 
M

Malcolm McLean

CBFalconer said:
I think you should dump that 'new compiler' very quickly. If it
can't handle a #include statement, it does not come anywhere near
meeting any standard. I shudder to think what else is missing.
Sometimes the compiler is split from the preprocessor. This is permitted,
though a preprocessor should exist.
 
T

Thad Smith

Horacius said:
I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.

Do you know about some program able to do this kind of task ?

Are you using the CCS compiler for PIC microcontrollers? That does indeed
want everything compiled together. You can do this by having a main file
#include other code modules.

Note that CCS is pretty far from Standard C. You _can_ mostly program in a
subset of C, but beware the non-standard features of the compiler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top