POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: My first C++ program Server Time
4 Nov 2024 13:46:11 EST (-0500)
  Re: My first C++ program  
From: Orchid XP v8
Date: 20 Sep 2008 05:58:53
Message: <48d4c95d@news.povray.org>
>> Yup. A simple and obvious mistake. But unfortunately, not one the 
>> compiler warned me about.
> 
>   Than turn on the warning flags. You should always compile with warning
> flags.
> 
> g++ -Wall -Wextra -pedantic -ansi -O3 yourprogram.cc

Actually, when I want to compile something, I usually just say "make 
foo". Otherwise GCC insists on naming it "a.out", which is very irritating.

I'm rather surprised that forgetting to return anything at all isn't 
considered a non-maskable error, but anyway... (Certainly returning 
something from a void function seems to cause an error.)

I guess at some point I'll have to read the GCC manpage to find out how 
to control it directly.

>   Learn to use makefiles too. You can use the attached generic makefile
> to automatically build your program. (You'll probably need gnu make.)
> 
>   (Note that if you add, remove or change any #include line in your
> program, except those which include standard libraries, you'll have to
> delete the .dep file before running make.)

So there *is* a way to automate dependency analysis?

Personally, I'm used to a programming language where I write some code, 
save it in a couple of files, and say "ghc --make Foo" and it 
automatically builds a dependency tree, decides which things do or don't 
need recompiling (including noting whether the *external* interface is 
different or not), compiles everything to machine code, and 
automatically links all the necessary libraries.

This whole concept of having to manually write makefiles and manually 
write header files and so forth just seems tedious and error-prone.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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