title: Compiling JVMTI agent (using GCC, on OSX Snow Leopard)
body: <p>I am trying to build a JVMTI agent using the g++ command on Snow Leopard and I get the following error:</p>
  
  <pre>
  $ g++ -o agent.so -I `/usr/libexec/java_home`/include agent.cpp
  </pre>
  
  <p><strong><pre>Undefined symbols: "_main", referenced from: start in crt1.10.6.o ld:
  symbol(s) not found collect2: ld returned 1 exit status</pre></strong></p>
  
  <p>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:</p>
  
  <pre>
        #include 
        #include 
  
        JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
        {
            std::cout &lt;&lt;"Loading aspect..." &lt;&lt;std::endl;
            return JNI_OK;
        }
  </pre>
  
  <p>Any help with the message would be greatly appreciated.</p>