Arduino MEGA 2560 code compling fine on Windows, but not on Ubuntu

Hi all, I'm having a odd problem with this code:

/*
  THE SPOTLIGHT
  "All your light is belong to us."
  Coded by (redacted)
  Worked on by (redacted)
*/

#include <SPI.h>
#include <SD.h>

int data[255];
int temparray[255];
int datacount = 0;
int avgcount = 0;
float halfavg = 0;
float avg = 0;

//pin definitions
const int SDR = 7;
const int SDY = 8;
const int SERREAD = 9;
const int SERERR = 10;
const int ANAREAD = 11;
const int ANAERR = 12;
const int light = A7;
const int temp = A8;

float counter = 0;

const int chipSelect = 4;

void setup() {
  Serial.begin(9600);
  String dataString = "";
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);

  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
  delay(1000);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);

  digitalWrite(SERREAD, HIGH);
  digitalWrite(SDY, HIGH);
  Serial.print("Initializing SD card...");
  digitalWrite(SERREAD, LOW);
  digitalWrite(SDY, LOW);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    digitalWrite(SDR, HIGH);

    while (1) {
      // make a string for assembling the data to log:
      String dataString = "";
      delay(1);
      digitalWrite(ANAREAD, HIGH);
      int lightlvl = 1023 - analogRead(light);
      int templvl = 1023 - analogRead(temp);
      data[datacount] = lightlvl;
      temparray[datacount] = templvl;
      datacount = datacount + 1;
      float time = (millis() / 1000);
      digitalWrite(ANAREAD, LOW);
      if (datacount == 255) {
        datacount = 0;
        halfavg = 0;
        avg = 0;
        for (int i = 0; i < 255; i++) {
          halfavg = halfavg + data[i];
        }
        avg = halfavg / 255;
        dataString += String(time) + "," + String(avg) + "," + String(templvl);
   
        if (1 == 1) {
          digitalWrite(SERREAD, HIGH);
          Serial.println(dataString);
          digitalWrite(SERREAD, LOW);
        }
        // if the file isn't open, pop up an error:
        else {
          digitalWrite(SDR, HIGH);
          Serial.println("error opening datalog.txt");
          while (1);
        }
      }
    }
    Serial.println("card initialized.");
  }
}

void loop() {
  // make a string for assembling the data to log:
  String dataString = "";
  counter = (counter + 0.306);

  delay(1);
  digitalWrite(ANAREAD, HIGH);
  int lightlvl = 1020 - analogRead(light);
  int templvl = 1020 - analogRead(temp);
  data[datacount] = lightlvl;
  temparray[datacount] = templvl;
  datacount = datacount + 1;
  float time = (millis() / 1000);
  digitalWrite(ANAREAD, LOW);
  if (datacount == 255) {
    datacount = 0;
    halfavg = 0;
    avg = 0;
    for (int i = 0; i < 255; i++) {
      halfavg = halfavg + data[i];
    }
    avg = halfavg / 255;
    dataString += String(time) + "," + String(avg) + "," + String(templvl);
    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.

    File dataFile = SD.open("datalog.txt", FILE_WRITE);

    // if the file is available, write to it:
    if (dataFile) {

      digitalWrite(SDY, HIGH);
      dataFile.println(dataString);
      dataFile.close();
      digitalWrite(SDY, LOW);
      // print to the serial port too:
      digitalWrite(SERREAD, HIGH);
      Serial.println(dataString);
      digitalWrite(SERREAD, LOW);
    }
    // if the file isn't open, pop up an error:
    else {
      digitalWrite(SDR, HIGH);
      Serial.println("error opening datalog.txt");
      while (1);
    }
  }
}

It isn't compiling because of the following errors:

/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/mega -I/usr/share/arduino/libraries/SPI -I/usr/share/arduino/libraries/SD /tmp/build3121876235550390916.tmp/Dataloggerv2.cpp -o /tmp/build3121876235550390916.tmp/Dataloggerv2.cpp.o 
In file included from /usr/share/arduino/libraries/SD/SD.h:20:0,
                 from Dataloggerv2.ino:10:
/usr/share/arduino/libraries/SD/utility/SdFat.h:289:25: warning: ‘prog_char’ is deprecated [-Wdeprecated-declarations]
   void write_P(PGM_P str);
                         ^
/usr/share/arduino/libraries/SD/utility/SdFat.h:290:27: warning: ‘prog_char’ is deprecated [-Wdeprecated-declarations]
   void writeln_P(PGM_P str);
                           ^
In file included from /usr/share/arduino/libraries/SD/SD.h:21:0,
                 from Dataloggerv2.ino:10:
/usr/share/arduino/libraries/SD/utility/SdFatUtil.h:58:45: warning: ‘prog_char’ is deprecated [-Wdeprecated-declarations]
 static NOINLINE void SerialPrint_P(PGM_P str) {
                                             ^
/usr/share/arduino/libraries/SD/utility/SdFatUtil.h:67:47: warning: ‘prog_char’ is deprecated [-Wdeprecated-declarations]
 static NOINLINE void SerialPrintln_P(PGM_P str) {
                                               ^
Dataloggerv2.ino: In function ‘void setup()’:
Dataloggerv2.ino:89:36: error: invalid operands of types ‘float’ and ‘const char [2]’ to binary ‘operator+’
Dataloggerv2.ino: In function ‘void loop()’:
Dataloggerv2.ino:130:36: error: call of overloaded ‘String(float&)’ is ambiguous
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:192:0,
                 from Dataloggerv2.ino:8:
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:70:11: note: candidate: String::String(long unsigned int, unsigned char)
  explicit String(unsigned long, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:69:11: note: candidate: String::String(long int, unsigned char)
  explicit String(long, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:68:11: note: candidate: String::String(unsigned int, unsigned char)
  explicit String(unsigned int, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:67:11: note: candidate: String::String(int, unsigned char)
  explicit String(int, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:66:11: note: candidate: String::String(unsigned char, unsigned char)
  explicit String(unsigned char, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:65:11: note: candidate: String::String(char)
  explicit String(char c);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:60:2: note: candidate: String::String(const String&)
  String(const String &str);
  ^
Dataloggerv2.ino:130:56: error: call of overloaded ‘String(float&)’ is ambiguous
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:192:0,
                 from Dataloggerv2.ino:8:
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:70:11: note: candidate: String::String(long unsigned int, unsigned char)
  explicit String(unsigned long, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:69:11: note: candidate: String::String(long int, unsigned char)
  explicit String(long, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:68:11: note: candidate: String::String(unsigned int, unsigned char)
  explicit String(unsigned int, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:67:11: note: candidate: String::String(int, unsigned char)
  explicit String(int, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:66:11: note: candidate: String::String(unsigned char, unsigned char)
  explicit String(unsigned char, unsigned char base=10);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:65:11: note: candidate: String::String(char)
  explicit String(char c);
           ^
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:60:2: note: candidate: String::String(const String&)
  String(const String &str);
  ^

Please help, i'm trying to condense some of the stuff like the millis functions, etc.

You're using an extremely outdated version of the Arduino IDE. Please uninstall it and then download and install the latest version of the Arduino IDE downloaded from:

Note that when you install the Arduino IDE from a package manager (e.g. apt-get install arduino), you get a very outdated and/or modified version of the Arduino IDE. For this reason, it is recommended to always download the official Arduino IDE from this website.

I didnt realize that. Thanks.

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per