POV-Ray : Newsgroups : povray.binaries.programming : command line Server Time
21 Dec 2024 22:08:41 EST (-0500)
  command line (Message 1 to 8 of 8)  
From: majucatur
Subject: command line
Date: 5 Mar 2002 00:34:46
Message: <3c8458f6@news.povray.org>
Hi

I have a little problem, well, I can't include the standard libraries in my
C project, I'm using the compiler TCC of Borland, now Free :) but without
documentation :( I can't compile a program properly. I was reading that I

how to do this. This should be very easy for some people here, because
POV-Ray requires to be compiled in this way. If someone could explain me the
way to compile a module-project correctly, and how to link the .obj files
when I finish.

I know that I need to write a .c module with functions, and a .h file with
its data types and global definitions. I need also a main file which
contains the function main() I suppose that I need compile the modules
first, and then the main file which uses the other modules. But when I use
libraries like math, it can't be compiled and tcc finish with a error
message explaining this.

Can somebody help me with this problem?

Thanks a lot.


Post a reply to this message

From: Warp
Subject: Re: command line
Date: 5 Mar 2002 07:00:38
Message: <3c84b366@news.povray.org>
majucatur <maj### [at] yahoocom> wrote:
> I know that I need to write a .c module with functions, and a .h file with
> its data types and global definitions.

  Why is it a so common misconception that you should put all the data types
of a .c file into its correspondent .h file?
  A .c file is a module, and its correspondent .h file declares its
*public interface*, that is, it declares the part of the module which other
modules need to see.
  Internal data types (and functions) used by the module are *not* part of
this public interface. Also global variables used solely in this module (even
though we don't use global variables, do we?) should be declared as static in
the .c file, not in the .h file. The .h file should always be as minimal as
possible.

  As for your actual question, I didn't understand it well enough to write
a proper answer.
  (Perhaps a really short example could help?)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Apache
Subject: Re: command line
Date: 5 Mar 2002 09:08:53
Message: <3c84d175$1@news.povray.org>
Hey man! I completely forgot about that. Thanks! I hate scrolling through
those .h files all the time to find out how I did those funky structs....


--
Apache
http://geitenkaas.dns2go.com/experiments/
apa### [at] yahoocom


Post a reply to this message

From: majucatur
Subject: RE: command line
Date: 5 Mar 2002 12:47:33
Message: <3c8504b5@news.povray.org>
Another example:

program.c - - - - -

#include <math.h>
#include <stdio.h>

void main() {
   float Var;
   printf("\nA number :");
   scanf("%f", Var);
   printf("\n\nThe square root of %f is %f\n", Var, sqrt(Var));
   getch();
}

- - - - -

that's all, how can I compile this in the command line?


Post a reply to this message

From: Warp
Subject: Re: command line
Date: 5 Mar 2002 17:09:50
Message: <3c85422e@news.povray.org>
I think that your problem is specific to the compiler you are using (it's
not seeing the standard include files for some reason). Only a person
familiar with that compiler can give a precise answer.
  It sounds strange, though (usually you don't need to do anything special
for the compiler to see its own include files).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Halbert
Subject: Re: command line
Date: 8 Mar 2002 22:45:07
Message: <3c898543@news.povray.org>
"majucatur" <maj### [at] yahoocom> wrote in message
news:3c8504b5@news.povray.org...
> Another example:
>
> program.c - - - - -
>
> #include <math.h>
> #include <stdio.h>
>
> void main() {
>    float Var;
>    printf("\nA number :");
>    scanf("%f", Var);
>    printf("\n\nThe square root of %f is %f\n", Var, sqrt(Var));
>    getch();
> }
>
> - - - - -
>
> that's all, how can I compile this in the command line?
>

I used Borland C++ from 1994-1997
Try:

tcc -ms program.c -oprogram.obj

Long ago when I used Borland C++ there was also command line options to use
floating point emulation (the default) and another to use the x87 library. I
don't know if such is the case with newer versions (that is how long it has
been since I used the Borland compilers.) -f87 for 8087 and -f287 for 80287.
This would precede the input file name.

After you compile and have the .obj(s) then you need to link it. When
I used the compilers, I had to use a memory model.

c0t.obj    tiny model(used for things like .com files. The program segment
prefix (PSP) is different for this model and there is no stack segment)
c0s.obj    for small model (appropriate for the source given.)
c0c.obj    for compact
c0m.obj    for medium
c0l.obj for large
c0h.obj    for huge

The linker that came with Borland was tlink.

tlink  /c  \Borlandc\lib\c0s program, program,,\borlandc\lib\maths
\borlandc\lib\cs

The /c makes the symbols case sensitive. the next two items are the .obj
files for this compile. First the small version standard c startup module
(along with the path)  then the program.obj we compiled before. the next
item is the output executable: program.exe. the ommited option is for a map
file. Last are the two small version libraries used: maths.lib for the sqrt
function, then cs the small version standard c library.

Keep in mind that I seldom use command line compilers these days and it has
been years since I've used Borland. Let me know if my take on dos-mode
command line compilers is too medieval. I hope this is at least partly
useful. I have the documentation around here somewhere in a box. If I find
it I will scan the relevent sections for you.



Post a reply to this message

From: Martial
Subject: Re: command line
Date: 21 May 2002 12:35:37
Message: <3cea7759$1@news.povray.org>
pardon for my english !
I use Borland55 free command line ! 

the doc Readme
1- . Run freecommandlinetools.exe; choose the 
   drive and folder into which you want to
   install the free C++Builder 5 command line 
   tool development system.
   
2. From the bin directory of your installation:
   a. Add "c:\Borland\Bcc55" 
           to the existing path
   b. Create a bcc32.cfg file which will set 
      t he compiler options for the Include 
       and Lib paths (-I and -L switches to 
       compiler) by adding these lines:

      -I"c:\Borland\Bcc55\include"
      -L"c:\Borland\Bcc55\lib"

   c. Create an ilink32.cfg file which will set 
      the linker option for the Lib path by 
      adding this line:

      -L"c:\Borland\Bcc55\lib"



I try your mini program it's good !

--
Martial


Post a reply to this message

From: Philippe Lhoste
Subject: Re: command line
Date: 12 Jul 2002 11:16:33
Message: <3d2ef2d1@news.povray.org>
"majucatur" <maj### [at] yahoocom> wrote:
> Another example:
>
> program.c - - - - -
>
> #include <math.h>
> #include <stdio.h>
>
> void main() {
>    float Var;
>    printf("\nA number :");
>    scanf("%f", Var);
>    printf("\n\nThe square root of %f is %f\n", Var, sqrt(Var));
>    getch();
> }
>
> - - - - -
>
> that's all, how can I compile this in the command line?

Ouch, it is off topic (since it will compile) but your program shows a very
common mistake:
scanf("%f", Var); should be scanf("%f", &Var); ie. you must give it the
address of the variable.

--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.