Error: number must be positive and less than 8

I do not understand what the error is; I have attached the error and will attach the code in the next message.

Arduino: 1.6.7 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s: Assembler messages:

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1288: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1289: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1294: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1300: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1304: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1310: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1313: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1316: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1322: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1326: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1332: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1366: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1372: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1375: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1379: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1384: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1395: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1398: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1402: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1406: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1409: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1415: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1440: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1441: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1443: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1445: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1447: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1476: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1478: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1513: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1515: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1517: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1519: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1521: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1548: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1550: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1576: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1577: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1578: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1579: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1582: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:1584: Error: number must be positive and less than 8

C:\Users\apatil\AppData\Local\Temp\cc4ZQvk0.s:2001: Error: number must be positive and less than 8

lto-wrapper: C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc returned 1 exit status

c:/programdata/matlab/supportpackages/r2017b/3p.instrset/arduinoide.instrset/idepkgs/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
/*********************************************************************/
/*                                                                   */
/*                          MAGSENS_COMM_TEST                        */
/*                                                                   */
/* Script to read out all registers of the AK09970N magnetic sensor. */
/*                                                                   */
/*********************************************************************/

/* First need to set up all port parameters before including the header file */
#define SDA_PORT PORTC
#define SDA_PIN 20                               /* analog pin A4 (this can be any analog pin) */
#define SCL_PORT PORTC          
#define SCL_PIN 21                               /* analog pin A5 (this can be any analog pin) */
#define I2C_FAST_MODE 1                         /* transmit at up to 400 kHz to maximize speed */

/* include the necessary header file with all defined functions and constants */
#include <SoftI2CMaster.h>
#include <stdint.h>  

/* define all other necessary preprocessor macros */            
#define I2C_7BITADDR 0x0C                       /* I2C address of AK09970N (CAD pin grounded) */
//#define I2C_7BITADDR 0x0D                       /* I2C address of AK09970N (CAD pin connected to VDD) */
                                                /* currently unclear which configuration is optimal */
#define MEMLOC_ST 0x10                          /* status register address in magnetic sensor;
                                                   all other registers of interest follow this */
#define NUM_REGS 24                             /* number of registers to access in the magnetic sensor */                                              
#define TRUE 1

            
void setup(void) {          
    Serial.begin(9600);            
    if (!i2c_init()) {                          /* Initialize everything and check for bus lockup */
        Serial.println("I2C init failed");
    }
}

void loop(void){

    uint8_t rd_data = 0;
    
    uint8_t mem_loc = MEMLOC_ST;                /* initialize first register read location */
    uint8_t reg_cntr = 0;                       /* initialize the register iterator */

    
    /* first need to generate a start condition */
    if (!i2c_start((I2C_7BITADDR << 1) | I2C_READ)) {
        /* could not start transfer of data to Arduino master */
        Serial.println("I2C device busy");
        return;
    }
    
    while (reg_cntr < NUM_REGS) {
        i2c_write(mem_loc);                             /* send memory address */
        i2c_rep_start((I2C_7BITADDR << 1) | I2C_READ);  /* restart for reading without sending a stop
                                                           condition */
        
        rd_data = i2c_read(TRUE);                       /* request to receive a byte from slave (send NAK
                                                           after receiving the byte to terminate */
        Serial.print("Register ");                      /* display the data collected from the sensor */
        Serial.print(reg_cntr);
        Serial.print(" contents: ");
        Serial.println(rd_data);
        delay(1000);                                    /* delay to read stream smoothly */
        
        reg_cntr++;                                     /* increment the register number */      
        mem_loc++;                                      /* increment register address to read next */
        
        if (reg_cntr < NUM_REGS) {
            i2c_rep_start((I2C_7BITADDR << 1) | I2C_READ);  /* restart to write next address without sending
                                                               a stop condition */
        }
        
        i2c_stop();                                     /* send a stop condition to release the I2C bus */
    }

}

Did not look at the code but octal numbers are 0-7. If you put a 0 in front of e.g. an integer, the compiler will interpret it as octal.

//Edit
Hmm, error does not seem to refer to the C/C++ code.

This is the verbose version split into 2 because the number of characters was too great:

Arduino: 1.6.7 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\apatil\Documents\Arduino\libraries" -fqbn=arduino:avr:pro:cpu=8MHzatmega328 -ide-version=10607 -build-path "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\apatil\Downloads\i2c_mag_test\i2c_mag_test\i2c_mag_test.ino"
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\apatil\Documents\Arduino\libraries" -fqbn=arduino:avr:pro:cpu=8MHzatmega328 -ide-version=10607 -build-path "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\apatil\Downloads\i2c_mag_test\i2c_mag_test\i2c_mag_test.ino"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\variants\eightanaloginputs" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp" -o "nul"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\variants\eightanaloginputs" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp" -o "nul"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\variants\eightanaloginputs" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp" -o "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino5/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\avr\1.6.21\variants\eightanaloginputs" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp" -o "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp.o"
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_pulse.S.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WInterrupts.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\hooks.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_analog.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_digital.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_pulse.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_shift.c.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\CDC.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial0.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial1.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial2.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial3.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\IPAddress.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\PluggableUSB.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Print.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Stream.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Tone.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\USBCore.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WMath.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WString.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\abi.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\main.cpp.o
Using previously compiled file: C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\new.cpp.o
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_pulse.S.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a"

This is the verbose version split into 2 because the number of characters was too great:

"C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WInterrupts.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\hooks.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_analog.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_digital.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_pulse.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\wiring_shift.c.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\CDC.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial0.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial1.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial2.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\HardwareSerial3.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\IPAddress.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\PluggableUSB.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Print.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Stream.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\Tone.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\USBCore.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WMath.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\WString.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\abi.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\main.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\core.a" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\core\new.cpp.o"
"C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p  -o "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW/i2c_mag_test.ino.elf" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW\sketch\i2c_mag_test.ino.cpp.o" "C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW/core\core.a" "-LC:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW" -lm
c:/programdata/matlab/supportpackages/r2017b/3p.instrset/arduinoide.instrset/idepkgs/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: cannot open output file C:\Users\apatil\AppData\Local\Temp\ArduinoServer\MW/i2c_mag_test.ino.elf: Permission denied

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.
#define SDA_PORT PORTC

#define SDA_PIN 20                              /* analog pin A4 (this can be any analog pin) /
#define SCL_PORT PORTC         
#define SCL_PIN 21                              /
analog pin A5 (this can be any analog pin) */
#define I2C_FAST_MODE 1

I didn't look at the documentation, but I'm thinking that the requirement to SCL_PORT means that SCL_PIN needs to be a bit-number WITHIN the port (which has to be 0-7), rather than an "Arduino Pin Number" (4 and 5 rather than 20 and 21)

(Edit: I looked around a bit more, and I found at least one SoftI2CMaster that uses bit numbers as I described, and another one that uses Arduino pin numbers. Which library are you using?)

Thank you so much! That fixed my compiler error. Now, I am getting that i2c_init() returns false. How may I go about fixing that problem?

An issue that I see that it can possibly be is that 4 and 5 would refer to digital pins rather than analog pins which would A4 and A5. However, that gives the same must be less than 8 error. Is this an issue I should be concerned about? If it is, how do I fix this?

Which library are you using?

SoftwareI2CMaster.h