C ++ will not work on my mac, symbol (s) not found for x86_64 architecture

advertisements

Heres the code, extremely basic Cpp

#include <iostream>
using namespace std;

int main(){
    cout << "C++ is FUN!\n";
    return 0;
}

The symbols that can not be found are "std" trying to use the name space, and "cout". the full error message is.

make: *** [FirstProject] Error 1    FirstProject            C/C++ Problem
Symbol 'cout' could not be resolved FirstProgram.cpp    /FirstProject   line 5  Semantic Error
Symbol 'std' could not be resolved  FirstProgram.cpp    /FirstProject   line 2  Semantic Error
symbol(s) not found for architecture x86_64 FirstProject            C/C++ Problem

EDIT: here is the whole linker line:

make all
Building target: FirstProject
Invoking: Cross G++ Linker
g++  -o "FirstProject"  ./FirstProgram.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [FirstProject] Error 1

Does anyone know what could potentially be the problem?


You are not compiling using a C++ compiler.

If you are using the GNU toolchain then use g++ and not gcc.