Author Topic: O2C  (Read 2009 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
O2C
« on: September 02, 2013, 08:38:11 AM »


Cool program. (literally) You need to send this to Antarctica as they need a some help.

 

JRS

  • Guest
Re: O2C
« Reply #1 on: September 02, 2013, 02:32:53 PM »
Charles,

I'm getting the following error(s) trying to compile your Exam1.c example.

Code: [Select]
jrs@laptop:~/B4A/xfer/O2/CLessons$ gcc Exam1.c -o Exam1
/tmp/ccNKDx5v.o: In function `ShowHWaves':
Exam1.c:(.text+0x40d): undefined reference to `sin'
Exam1.c:(.text+0x431): undefined reference to `sin'
/tmp/ccNKDx5v.o: In function `ShowVWaves':
Exam1.c:(.text+0x57a): undefined reference to `sin'
Exam1.c:(.text+0x5a1): undefined reference to `sin'
/tmp/ccNKDx5v.o: In function `ShowVWaves2':
Exam1.c:(.text+0x757): undefined reference to `sin'
collect2: ld returned 1 exit status
jrs@laptop:~/B4A/xfer/O2/CLessons$

Here are the results of trying to compile Exam2.c.

Code: [Select]
jrs@laptop:~/B4A/xfer/O2/CLessons$ gcc Exam2.c -o Exam2
Exam2.c: In function ‘q14’:
Exam2.c:28:5: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[8]’ [-Wformat]
/tmp/ccTEqgnz.o: In function `Qxxx':
Exam2.c:(.text+0x39f): undefined reference to `pow'
collect2: ld returned 1 exit status
jrs@laptop:~/B4A/xfer/O2/CLessons$

My error!

I forgot to add -lm to my gcc command line.

Exam2.c still has the following warning. BTW: If you enter a letter instead of a number, the program goes into an endless loop.

Code: [Select]
jrs@laptop:~/B4A/xfer/O2/CLessons$ gcc Exam2.c -lm -o Exam2
Exam2.c: In function ‘q14’:
Exam2.c:28:5: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[8]’ [-Wformat]
jrs@laptop:~/B4A/xfer/O2/CLessons$
« Last Edit: September 02, 2013, 03:05:27 PM by JRS »

Charles Pegge

  • Guest
Re: O2C
« Reply #2 on: September 03, 2013, 01:55:41 AM »
I wouldn't bother with those 'Exam..' examples. They were workouts with Harri who I was tutoring for a university exam. He was working in Objective-C on an Apple, while I was working in GCC on the PC, answering various questions on C programming.


JRS

  • Guest
Re: O2C
« Reply #3 on: September 03, 2013, 07:29:58 AM »
Okay, I understand. I'll treat this as a folder of Charles's PowerSnippets.  8)