View previous topic :: View next topic |
Author |
Message |
Exempt Newbie cheater Reputation: 0
Joined: 15 Aug 2012 Posts: 10
|
Posted: Mon Jul 31, 2017 9:10 pm Post subject: C++/VStudio not a valid type after adding a second function |
|
|
I'm working on making a JVMTI client just to get a bit of experience with it but visual studio is starting to beat me here.
So this will compile perfectly fine however if I try to add another function it's like my headers are broken and all the defines from jni like jint and JNICALL are not valid types anymore.
Code: | #include <jvmti.h>
#include <iostream>
using namespace std;
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved)
{
cout << "AgentLoading..." << endl;
return JNI_OK;
} |
This is all I do to break it...
Code: | #include <jvmti.h>
#include <iostream>
using namespace std;
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved)
{
cout << "AgentLoading..." << endl;
return JNI_OK;
}
JNICALL jint objectCallback(jlong class_tag, jlong size, jlong* tag_ptr, jint length, void* user_data)
{
return JVMTI_VISIT_OBJECTS;
} |
errors are like..
variable "jint" is not a type name
JNICALL error - this declaration has to storage class or type specifier
|
|
Back to top |
|
|
Exempt Newbie cheater Reputation: 0
Joined: 15 Aug 2012 Posts: 10
|
Posted: Wed Aug 02, 2017 8:32 pm Post subject: |
|
|
This is for sure some random setting in VS as it works fine in code blocks.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Fri Aug 04, 2017 1:55 pm Post subject: |
|
|
jint appears to be a custom type implemented by the JavaVM code, probably just a typedef to a normal int such as:
For VS to error saying its not a valid type, there would need to either be a missing include somewhere that defines this type, or there are missing #defines needed to ensure the proper compiling settings are being enabled in the various Java headers.
_________________
- Retired. |
|
Back to top |
|
|
|