Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++/VStudio not a valid type after adding a second function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Exempt
Newbie cheater
Reputation: 0

Joined: 15 Aug 2012
Posts: 10

PostPosted: Mon Jul 31, 2017 9:10 pm    Post subject: C++/VStudio not a valid type after adding a second function Reply with quote

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
View user's profile Send private message
Exempt
Newbie cheater
Reputation: 0

Joined: 15 Aug 2012
Posts: 10

PostPosted: Wed Aug 02, 2017 8:32 pm    Post subject: Reply with quote

This is for sure some random setting in VS as it works fine in code blocks.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 137

Joined: 25 Jan 2006
Posts: 7286
Location: 127.0.0.1

PostPosted: Fri Aug 04, 2017 1:55 pm    Post subject: Reply with quote

jint appears to be a custom type implemented by the JavaVM code, probably just a typedef to a normal int such as:

Code:
typedef int jint;


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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites