NO

Author Topic: how to compile multiple source files?  (Read 6172 times)

JD

  • Guest
how to compile multiple source files?
« on: March 16, 2006, 07:51:44 AM »
hi,

i've just downloaded pelles c version 4.00. i've managed to compile, build & execute one program i've typed up but i can't seem to to get a second one working because of the error below:

POLINK: error: Symbol '_main' is multiply defined ('chapter 2 programming project 1.obj' and 'chapter 2 programming project 2.obj').
*** Error code: 1 ***

what does this error mean? the second program i have been trying to compile, build & execute has been added to the project. should i be making new projects for each new source code i create?

JD

  • Guest
how to compile multiple source files?
« Reply #1 on: March 16, 2006, 08:16:50 AM »
it's ok. noone needs to reply to these messages. i've figured out how to build & execute the programs.

isaiasbhz

  • Guest
Re: how to compile multiple source files?
« Reply #2 on: July 30, 2012, 10:28:10 PM »
it's ok. noone needs to reply to these messages. i've figured out how to build & execute the programs.
Hi, how did you do?
I have the some problem. I can't compile projects with more than a file.
Help me please.
regards

CommonTater

  • Guest
Re: how to compile multiple source files?
« Reply #3 on: July 30, 2012, 11:38:53 PM »
it's ok. noone needs to reply to these messages. i've figured out how to build & execute the programs.
Hi, how did you do?
I have the some problem. I can't compile projects with more than a file.
Help me please.
regards

First read the Pelles C help file at  ...

Help -> Contents -> Integrated Environment -> POIDE Integrated environment -> Your first PC project

That will show you how to create a proper Project.

Then to add a new source file click File -> New -> Source  or click the New button on the toolbar.
Type or paste in your source code
Save the file... POIDE will ask you if you want to add it to your current project.  Click Yes.

Now you can compile and run your program with multiple source codes.

From a source  code standpoint you must write headers so that your secondary sources are included into your main file so it all becomes one big load of code.  Any competent C text book should explain how to do that for you.
 
If you want to see an example of using multiple sources to build a single project you can download THIS PROJECT and have a look at how it's set up... 
 
 (As s procedural note:  It's often better to start a new forum thread than to jump onto a really old one...)
 
« Last Edit: July 30, 2012, 11:46:22 PM by CommonTater »

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: how to compile multiple source files?
« Reply #4 on: July 31, 2012, 03:33:42 AM »
it's ok. noone needs to reply to these messages. i've figured out how to build & execute the programs.
Hi, how did you do?
I have the some problem. I can't compile projects with more than a file.
Help me please.
regards
Well, two general questions, as you did not provide any piece of information that would give a clue as to why you can't "compile projects with more than a file":

1) how did you add  those files to the project?
2) what is the error message(s) you get?

Ralf

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: how to compile multiple source files?
« Reply #5 on: July 31, 2012, 07:31:34 AM »
The original poster six years before had the problem of multiple main() functions in his code, so he only had to get rid of the excess main() functions.

Treat every warning as an error and correct your code to remove any warning.
Watch out to not get caught by the compiler warning to improve yourself ;)
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: how to compile multiple source files?
« Reply #6 on: July 31, 2012, 02:35:52 PM »
Watch out to not get caught by the compiler warning to improve yourself ;)

:D I still remember the first time I saw that one... "More than 100 errors, please improve yourself" ... It was the absolute last thing I expected to see.... Best laugh I had for months!