Jump to content

  • Log In with Google      Sign In   
  • Create Account


SpaceEmotion

Member Since 25 Jul 2012
Offline Last Active Jun 08 2013 09:53 AM
-----

Posts I've Made

In Topic: Problems with linking files (Undefined symbols for architecture x86_64)

25 July 2012 - 10:06 AM

Thank you rip-off, that solved my issue!!

However I now have problems starting my program. It somehow does not recognizes the main function. Does it have to do something with the SDLMain.m and SDLMain.h files I need for mac applications? (Error: Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o). My function is currently "int Main(int argc, char* argv[])", when I change "Main" to "main" it also does not work Posted Image

Edit: I used Netbeans, I tried XCode insteaad and it worked! Thanks for the support :)
- can be closed now -

In Topic: Problems with linking files (Undefined symbols for architecture x86_64)

25 July 2012 - 06:16 AM

You have declared your static variable Console::prefix, but you have yet to define it. The definition goes in a single source file (the obviously candidate being console.cpp) and looks like this:

string Console::prefix;

You may want to initialise it with a default prefix:
string Console::prefix = "[hello, world]";


I now added the following lines to the Console class in console.cpp (Under "public:"):
Console() {
prefix = "[Log]";
}

Tried to build and got the following error now:
Undefined symbols for architecture x86_64:
  "_main", referenced from:
	  start in crt1.10.6.o
  "Console::prefix", referenced from:
	  Console::setPrefix(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in console.o
	  Console::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in console.o
ld: symbol(s) not found for architecture x86_64

Does is has to do something with the strings maybe? (I personally don't think so though)
Or does it has to be something with the way how I use the fields of the class?

PARTNERS