0

How can I use a function written within a .cpp saved in a folder different from the one that needs that function? For all the .cpp of the first folder I've simply added an #include to the .h of the cpp (and it works fine), but trying to add an #include "..\Folder1\....h" to all the .cpp of the second folder is not enough and the Borland C++ Builder gives me the Unresolved external error.
What can I do?
Thanks

Johan
  • 74,508
  • 24
  • 191
  • 319
Ant4res
  • 1,217
  • 1
  • 18
  • 36

2 Answers2

1

You need to compile the cpp file into an object file (.o) inside its own directory and link that object file with your program.

perreal
  • 94,503
  • 21
  • 155
  • 181
1

Add the location of the object files to your linker search path.

Project Options Dialog

Community
  • 1
  • 1
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217