I am trying to build a JVMTI agent using the g++ command on Snow Leopard and I get the following error:
$ g++ -o agent.so -I `/usr/libexec/java_home`/include agent.cpp
Undefined symbols: "_main", referenced from: start in crt1.10.6.o ld:
symbol(s) not found collect2: ld returned 1 exit status
I am a total novice when it comes to gcc and C++ programming so I have no idea what that error means. The agent itself is extremely basic:
#include #include JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { std::cout <<"Loading aspect..." <<std::endl; return JNI_OK; }
Any help with the message would be greatly appreciated.