[C++] expected a declaration error

Garret

Member
Joined
Apr 27, 2017
Messages
15
Reaction score
1
Hello, I'm having a problem with an .asi file, I keep getting the error "expected a declaration" at the start of my program.

Source:
https://pastebin.com/1HNEMpKg

Getting the error at line 7. If anyone could help, I'd be really grateful, I'm a newbie and I'm trying to learn as much as possible. Thanks.
 

Garret

Member
Joined
Apr 27, 2017
Messages
15
Reaction score
1
If I remove that bracket I get the following errors:
expected a ';' on line 7
expected a ';' on line 14
indentifier "loop" is undefined at line 18
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Class holder should be closed with brackets and semicolon at the end, an example :
Code:
class Test
{
//
};

I'm still ill and didn't notice you had this on 33rd line, so in addition to my post, you should also remove the bracket on the 13th line
//
There's no reason to put __stdcall in a function declaration since it goes as the default calling conventions in the modern compilers (VS)
But there's also other function calling conventions such as __fastcall, __cdecl, etc.. These might be useful, but not at your current level, better go deep for them when you'll gain some experience
//
I don't think you really should put a dll entry point into the namespace, so you better remove it
After you moved it outta there, you should also add Example:: to your MainThread because it belongs to the Example namespace
//
There's no point to give MainThread a void * argument unless you want to scope it inside of a class and multi-thread it 
//
19th line : you are trying to call a function that is out of a scope, if you want to call it properly, create a new instance outside of a loop, but inside of a function and give it an alias, if you don't want to create the instance so you'd like to access variables that will be modified by this loop later on - make it extern instance

Yes, I could have gave you already fixed code, but it's better to google everything you didn't understand in my message and read about these things completely, at least, it's better for an education

I'm still might not notice something or be wrong somewhere, guess @0x688 this nibba would help you more (if he'll finish to smoke his dope and play some Fortnite with me)
 

Garret

Member
Joined
Apr 27, 2017
Messages
15
Reaction score
1
Tried to do what you said, searched everywhere, still getting errors. I'll just give up, thanks for trying to explain to me.
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
174
Maybe you should also consider moving your DLL entry point out of your class it's not constructed and your entry point has nothing to do in there.

  • You can't pass a class member to CreateThread
  • The class is obsolete for such simple code.
  • You need to move your entry-point out of the class.
 
Top