I found a example code, and want to compile it as C++, but there's some questions I have.
I'm from the PC world and have used Visual Studio and a little Linux (GCC), but the Visual Studio enviroment makes it a lot easier than have to fiddle around with make files... Ok, I'm now trying to use CodeBench, so I don't have to use shell at least... :)
Well, first is what "program" should I use for compiling, in the SDK:gcc/bin directory is there a lot of files, and what's the difference between the "g++" and "ppc-amigaos-g++"?
Is the "g++" for 68k processors and the other for the new X1000 (PPC), as the names almost say?!
The file "cpp" and "ppc-amigaos-cpp", what's that, the C++ compiler? I have searched in the GNU doc, but can't find some explanations of all files.
When I try to compile, I get these messages:
myfile.o:(.sbss+0x18): multiple definition of 'IExec'
myfile.o:(.sbss+0x1c): multiple definition of 'IDOS'
...and don't get these errors when I run the code as "C" (I think, atleast the original code and compiler settings). It may be the errors that Windows uses "#pragma once" for, but not sure, and I have only two files, the *.c and *.h file.
Mon, 2012-01-09 05:43
#1
C++ compiler
gcc -v test.c -o test
Also for more detailed help you can use "-save-temps" , like:gcc -save-temps test.c -o test
That will keep for you all files which done in the middle by gcc/g++ wrappers, and which used on the way from source file to executable one. test.i - that one are preprocessed (by cc1, the same as cpp by logic) test.s - assembly listing test.o - object Upload your code somethere, so we can check. @Salas00 As far as i can see, i can just remove cpp and ppc-amigaos-cpp from SDK at all, and all still will works fine. What make me think, that by default only cc1/cc1plus are used for preprocessing, but not cpp.#include <proto/exec.h>
. If you want dos library, you use#include <proto/dos.h>
. If you want reaction, you include necessary reaction protos, if mui, then mui ones. Of course, there is still some includes, which not in "proto". But, including of proto are enough for most basic libs and functions. But sure, you will find in some examples, that together with protos, other ones are used as well. Like in our source you can find: