Multiple Files in a project Error

Iam beginning to do a small project to hone my programming skills and iam stuck here...plz tell me how to correct it

main.cpp : http://pastebin.com/zXDtuCyj
ship.h : http://pastebin.com/EMA2EM1z
ship.cpp : http://pastebin.com/WqfJe3cj

Error: http://imgur.com/pP7F5oU

Thank You All...
You never define map in your header, so when ship.cpp wants to use it, it cannot find it as it has never been declared in that file. You could try adding the following code in your header file:

 
extern char map[25][10];


This declares your map variable. The extern part states that it is defined in another translation unit. You can simply think of a translation unit as a source file with all header files it includes.

Another quite important thing is that you are including the source file in your main.cpp file. You should always only include the header file (except when working with templates, but that's a special matter outside the scope of this question). So change: #include "ship.cpp" to #include "ship.h" .
Last edited on
-Shadowwolf tysm! that fixed it!!
Topic archived. No new replies allowed.