First Cup of Ubuntu
I want to try the code below and It is a code with preprocessors. I get an error.
Can anyone can tell me the reason?
#define HATALI(A) A*A*A /* Kup icin hatali makro */ #define KUP(A) (A)*(A)*(A) /* Dogusu . */ #define KARE(A) (A)*(A) /* Karesi icin dogru makro */ #define START 1 #define STOP 9 main() < int i,offset; offset = 5; for (i = START;i >
'printf' was not declared in this scopeJune 2nd, 2007 #2
Iced Blended Vanilla Cr�me Ubuntu
You forgot#include June 2nd, 2007 #3
First Cup of Ubuntu
when included the header file
it returned an error:
studio.h: No such file or directory
Iced Blended Vanilla Cr�me Ubuntu
stdio.h (not studio.h)June 2nd, 2007 #5
First Cup of Ubuntu
anyway, the program give a more garbled error.
what does this error mean?
how can I fix the problem?
/tmp/ccGQNcoh.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld output returned 1June 2nd, 2007 #6
Iced Blended Vanilla Cr�me Ubuntu
What command did you use that results in that error?June 2nd, 2007 #7
First Cup of Ubuntu
I'm using vi editor and first of all I created a file like this:
user@user-desktop:~$ vi example_macro.cpp
then I compiled the file by the command:
sh-3.1$ gcc example_macro.cpp -o objmacro
by the way I have a off topic question,
I have created a file:
user@user-desktop:~$ mkdir make_file_work
then I go and look both the 'user' file and to the 'desktop' I cannot find such a directory? But if I write the command:
user@user-desktop:~$ cd make_file_work
I can go inside that file, but I cannot see it in the file browser.
thanks again for your help WW.
June 2nd, 2007 #8Iced Blended Vanilla Cr�me Ubuntu
You appear to be writing C, not C++. Rename the file to example_macro.c, and try again. (I just tried it both ways; I got the same error that you did when the file was called example_macro.cpp, and it compiled fine when I called it example_macro.c.)June 2nd, 2007 #9
Spilled the Beans
It'll compile as a .cpp if you put the line.
using namespace std;
under the include for stdio.h, or preface printf with "std::" in order to tell the compiler that you're using a function from the standard namespace.
June 3rd, 2007 #10First Cup of Ubuntu
Yes, it compiled when I changed the extesion from .cpp to .c. But I dont know the diferrences between the c and cpp.
Does the reason depends to 'printf' function? Because, as far as I remember I use cout function instead of printf in cpp. I guess printf is a c function.
But when I tried with
#include
using namespace std;
it gave an error again. the error the same:
/tmp/ccubDW3d.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld output return 1
what does this error mean anyway?
"/tmp/ccubDW3d.o" . what is the object ccubDW3d.o in the 'tmp' directory?
"(.eh_frame+0x11)" . can this be an address?
"undefined reference to `__gxx_personality_v0'" : it says '__gxx_personality_v0' and says there is an undefined reference to this 'thing'. But I've not use that thing in my . . . code. What does it refer to in my code?
"collect2: ld output return 1" : what is collect 2? What is ld output? What does returning 1 means?
WW and Mime thanks for help