All:
I have successfully set up two projects (Hello and World) in one workspace (HelloWorld). These are simple projects that are supposed to work together as a main project and a shared library project. This is the structure:
HelloWorld
Hello
src
Hello.cpp
Debug
src
Hello - [x86_64/le]
World
src
World.cpp
World.h
Debug
src
libWorld.dylib - (x86_64/le]
I have followed all instructions and finally was able to get them to compile with no errors. However, when I try to run the Hello project I receive the following error:
dyld: Library not loaded: libWorld.dylib
Referenced from: /Users/pdl/Development/HelloWorld/Hello/Debug/Hello
Reason: image not found
I posted the code below. It is super simple and the problem (I believe) is somewhere in the Eclipse configuration.
Thank you in advance for your help.
-------------------------------------------- Source Code ----------------------------------
Hello.cpp
#include <stdio.h>
#include "World.h"
int main() {
printf("Hello %s
", getWorld().c_str());
return 0;
}
World.cpp
#include "World.h"
std::string getWorld() { return "World"; }
World.h
#include <string>
std::string getWorld();
See Question&Answers more detail:os