it looks like my file compiles but it doesn't work correctly, and I get this msg:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help much appreciated.

``````// Helper functions for music

#include <cs50.h>

#include "helpers.h"

// #include "math.h"
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>

// Converts a fraction formatted as X/Y to eighths
int duration(string fraction)
{   int eighths;
// TODO
//prompt user for the fraction
fraction = get_string("Please enter a fraction in the format X/Y");
//convert divisor to an integer
int divisor = fraction[0];

//convert divisor to an integer
int dividend = fraction[2];

//calculate how many eights
if(dividend == 8)
{
//get the eighths from divisor
eighths = divisor * 1;
}
else
{
//convert other fractions into eights with a common denominator
int common = 8 / dividend;
eighths = divisor * common;
}
printf("%i\n", eighths);
return eighths;
}

// Calculates frequency (in Hz) of a note
// The frequency, f, of some note is 2n/12 × 440, where n is the number of semitones from that note to A4
// (2 to the power of n/12) * 440
int frequency(string note)
{
// TODO
// take as input as a string a note (e.g., A4)
note = get_string("Please enter a letter and number to represent your note. A flat or sharp may be placed after the letter.\n");
//define the letter character
char letter= note[0];

//validate a letter from A to G, ascii 65-71
for (int ascii=65; ascii < 72; ascii++)
{
if (letter == ascii)
{
ascii++;
}
else
{
printf("Please enter a capital letter between A and G.");
}
}

//determine whether the number of the octave is the 2nd or 3rd character

//define octave (in array), octaves and tones
int octaves;
int octaven;
int wavelength;
//check if the 2nd character is a number
if (!isalpha(note[1]))
{
octaven = note[1];
}
else
{
octaven = note[2];
}

// validate the octave is a number from 0 - 8
for (octaves = 0; octaves < 9; octaves++)
{
if (octaven == octaves)
{
return 0;
}
else
{
printf("Please enter a note with a number between 0 and 8.");
}
}

// The frequency, f, of some note is 2n/12 × 440, where n is the number of semitones from that note to A4
// (2 to the power of n/12) * 440
// frequency = 2 ** (n / 12) * 440
int tones = 0;
if (letter == 'A')
{

//check for octaves below 4 - for A0 to A3
if (octaven >= 0 && octaven <= 3)
{
//substract octave from 4 and store in tones
tones = 4 - octaven;
}
// check for octaves above 4 - for A5 to A8
else if (octaven >= 5 && octaven <= 8)
{
tones = 4 + octaven;
} else
{
tones = 0;
//test A
printf("%i\n", tones);
}
}
else
{
return 1;
}

//define semitones
int n = tones * 2;
printf("%i\n", n);

// frequency = 2 ** (n / 12) * 440
// pow(10.00, 2.00)
wavelength = round((pow(2.00, (n / 12.00)) * 440));
// frequency = round((2**(n / 12)) * 440);
printf("%i\n", wavelength);
return wavelength;
}

// Determines whether a string represents a rest
bool is_rest(string s)
{
int wavelength = 0;
// TODO
s = get_string("Please enter a note.");
// int strcmp(const char * s1, const char * s2);
if(strcmp(s, "") == 0)
{
wavelength = 0;
}
return wavelength;
}
``````

I can only guess you didn't compile by just calling `make` (equivalent to `make all`, as `all` is first target in makefile), or `make notes`, or `make synthesize`.
Your for loops make no sense to me (did you mean something like `if (octaves < 0 || octaves > 9)`? Just assume all input is valid, we don't even have a way to signal an error)
Also, remember ASCII, which you learnt about in pset2. Digit character `'4'` is not the same as number `4` (in fact it's 52 or 0x34 as you can see in the ASCII table)