-3

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?

TopQuark
  • 25
  • 1
  • 5

2 Answers2

0

You are not compiling using a C++ compiler.

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

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
0

You need to compile then link:

g++ -c -o FirstProgram.o FirstProgram.c
g++ -o FirstProject FirstProgram.o

Or you can combine into one statement:

g++ -o FirstProject FirstProgram.c
Thomas Matthews
  • 56,849
  • 17
  • 98
  • 154