SDK Compiler Error Help

Joined
Jul 21, 2003
Messages
7,819
Location
Adelaide, South Australia
Well, my first attempt at C++ was a wash-out. Tried adding two new 'hooks' in the XML, namely StateReligionCommerceModifier and StateReligionYieldModifier. Thought I had done everything right but, when it came time to compile it, it didn't like ANY of my additions. In particular it didn't like the fact that I had two seperate commerce and yield array lines :(. Any idea where I might have gone wrong, or will you need to see the error messages to make that judgement?

Aussie_Lurker.
 
Aussie_Lurker said:
Any idea where I might have gone wrong, or will you need to see the error messages to make that judgement?
We'll need to see the error messages and the code for the lines the errors are on (+ a bit around). It's probably only worth posting the 1 or 2 errors.
 
OK, we have these lines

Code:
'<unknown>': modifiers not allowed on non-member functions
          function returns function
Both are in relation to this line of code:

Code:
DllExport int getStateReligionCommerceModifier() (int i) const;             
	int* getCommerceModifierArray() const;

and something similar for Dll Export int get StateReligionYieldModifier() (int i) const;

Does that help at all?

Aussie_Lurker.
 
Sorry, you are right of course (damn, sprung ;) ). Actually Kael, this is the issue I raised in your SDK tutorial thread (about adding new XML schema). Do you think I am on the right track that the cause is due to me not altering the XML files first?

Aussie_Lurker.
 
Aussie_Lurker said:
Code:
DllExport int getStateReligionCommerceModifier() (int i) const;             
	int* getCommerceModifierArray() const;
Try changing that to:
Code:
DllExport int getStateReligionCommerceModifier(int i) const;             
	int* getCommerceModifierArray() const;

Note that I removed the "()" after getStateReligionCommerceModifier.
 
OK, a new problem guys.

Have the following code:

Code:
DLLExport int getStateReligionModifier(int i) const;        // Exposed to Python
	int* getStateReligionYieldModifierArray()const;

this is giving me the following error messages:

Code:
1254 error C2144: Syntax Error : int should be proceeded by ;
Even though none of the other lines have ;int or int;???

Code:
1254 error 2501: 'CvCivicinfo::DLLExport' : missing storage-class or type specifiers

Can anyone suggest what I am doing wrong here?

Aussie_Lurker.
 
Aussie_Lurker said:
Code:
1254 error C2144: Syntax Error : int should be proceeded by ;
Even though none of the other lines have ;int or int;???
I can't see anything obviously wrong with that. Would it be possible to post the file?
 
Sure, here are the 2 files-CvInfos.cpp and CvInfos.h I reckon that if I understand where I am going wrong, it will make things easier when I try it next time. I have followed Kael's instructions very closely, but am still coming up a cropper. Thanks for the offer of help-it is much appreciated :).

Aussie_Lurker.
 

Attachments

I've had a quick look. That first error turned out to be due to case sensitivity. "DLLExport" should be "DllExport". There are some errors in your cpp file after that, but I'll let you have a go at fixing those yourself. Learning by doing tends to work much better than someone just doing the work for you ;).
 
You will not get any kind of Compile error due to not having changed XML files, the compiler is totaly un-aware of the XML files. Once you have the new dll succesfully compiled though you will need to change XML files to get things working, if you remembered to initialize your variables properly and dont update the XML then you should just get no effect as all the variables remain NULL or zero when thouse new XML tags arn't found. Once your new XML files are are combined with the DLL you will get your data loaded into the game. Ofcorse you might get XML schema or loading errors if you didn't do them correctly (they are very picky). I recomend loading the new XML under un-moded dll this way you can check the loading and be shure that any problems are XML related and not with your new dll. Then combine XML and dll and pray it works, if it dosn't they you have a problem in the pStream->(XMLLodader) functions.

I speak from experience as this is currently the state of my Mod, which atempts to add a rather complex Matrix of SpecialistYield Changes to Technologies. These are much harder to do then single boolean or int values because of the numerous for loops to load the values. I recomend you be proficient with the simpler type before going for arrays or matrics.
 
OK, I have solved the problems in the header, but am still getting heaps of error messages from my .cpp file. I have gone through and solved what I can clearly see (like I kept leaving YieldModifier and CommerceModifier-instead of adding in StateReligion).
Look, if I post the file again, could someone look at it and at least point me in the right direction? Like, if you simply suggest how I can alter the code so that I can make StateReligionYieldModifier a member of CvCivicInfos-that would be a start ;).
Please, PLEASE help me :)!!!!

Aussie_Lurker.
 

Attachments

Back
Top Bottom