[rust-dev] How to build multiple .rs source files?

Amitava Shee amitava.shee at gmail.com
Tue Apr 10 05:56:51 PDT 2012


Thanks.

Just to confirm my understanding - rustc deviates from the gcc way of
generating object files and linking them together without first packaging
them into libraries.

Is there a way to compile and link several .rs files into a single
executable without an intermediate library?

-Amitava

On Tue, Apr 10, 2012 at 2:23 AM, Grahame Bowland <grahame at angrygoats.net>wrote:

> Hi Amitava
>
> I've attached a simple template from a project I'm working on. I've got a
> dependency "rust-csv" which I'm not building with cargo, but from a git
> submodule.
>
> I use stamp files for the libraries, as the output files are versioned and
> thus the filename produced changes.
>
> Hopefully this is of use.
>
> Grahame
>
> On 10 April 2012 05:26, Amitava Shee <amitava.shee at gmail.com> wrote:
>
>> Is there a starter project or a Makefile?
>>
>> When I try to compile a source file without linking, I get the following
>> error
>>
>> amitava:learn amitava$ rustc -g -c shape.rs
>> shape.rs:1:0: 1:0 error: main function not found
>> shape.rs:1 class shape {
>>            ^
>> error: aborting due to previous errors
>>
>> How do I compile several source files to obj files and then link them
>> together into an executable?
>>
>> Thanks & Regards,
>> Amitava Shee
>>
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>>
>


-- 
Amitava Shee
Software Architect

There are two ways of constructing a software design. One is to make it so
simple that there are obviously no deficiencies; the other is to make it so
complicated that there are no obvious deficiencies. The first method is far
more difficult.
-- C. A. R. Hoare The Emperor's Old Clothes, CACM February 1981
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120410/4107abfc/attachment.html>


More information about the Rust-dev mailing list