Topic: Newbie Needs Help On Errors - SFC3 API  (Read 8336 times)

0 Members and 1 Guest are viewing this topic.

Captain Evans

  • Guest
Newbie Needs Help On Errors - SFC3 API
« on: March 16, 2003, 10:11:37 am »
I followed the instructions for setup and building scripts in the readme. Now I get the following errors when building:

Code:
Compiling...
WorldConditions.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerTeamInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerTeamShipInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerTeamShip.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerTeam.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
TaskForceTeamShipInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
TaskForceTeamShip.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
TaskForceLeaderShipInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
TaskForceLeaderShip.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
TaskForceTeam.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
FederationTeamInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
StrikeLeaderShipInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
StrikeLeaderShip.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
FederationTeam.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
KlingonTeamInitialState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
KlingonLeaderShip.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
KlingonTeam.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerVictoryState.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
PlayerVictoryCondition.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Borg_Cavalry.cpp
..\..\Shared\Source\Taldren\Common\Thread\Optex.cpp(379) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
MissionMaps.cpp
MissionText.cpp
Error executing cl.exe.

Borg_Cavalry.scr - 20 error(s), 0 warning(s)



Now I'm not VC++ literate. Could someone assist me in correcting this?  

Captain Evans

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #1 on: March 16, 2003, 01:56:06 pm »
I did have the .NET framework installed beforehand. But uninstalling it didn't help. So... commenting out the line:

thisThreadOwnsTheOptex = (0 == ::InterlockedCompareExchange( (void**)&fSharedInfo.fLockCount, (void*)1, 0) );

seems to work. I rebuilt the Borg_OldFriends.src and played it through. Everything was good except I noticed the script increased in size from 404 to 416. Can anyone think of where I would run into a problem commenting that line out?  

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #2 on: March 17, 2003, 06:27:30 am »
Hmmm...I can't wait to read an answer to this one.

Best,
Jerry  

The_Pelican

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #3 on: March 17, 2003, 01:25:00 pm »
No idea whatsoever, don't worry about the file size increase, probably just a few extra comments for the API.

According to the comments, that area of the script is only used for Windows 9x, if you're on XP (like me), or NT, then it's presumably not used. So I can't tell you if it is needed or not. As long as the script compiles, and plays fine, it's not a problem I guess.

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #4 on: March 18, 2003, 08:06:39 am »
after commenting that line out you didn't get any more errors?

Best,
Jerry  

FPF_TraceyG

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #5 on: March 18, 2003, 05:08:55 pm »
If you've installed .net and then when back to Visual C++ v6.0, .net will have already altered some system files which (as far as I know), are never removed and your system is permanently changed forever. Also, they aren't compatible with each other, I think that's been mentioned before though (Microsoft.... ppphhhhttt!!).
The void pointer error you're getting is a result of using .net architecture. If you're using Visual C++ v6.0 and still getting this error, off hand I would say it was because you had already previously installed .net onto your computer.

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #6 on: March 18, 2003, 07:53:56 pm »
Quote:

If you've installed .net and then when back to Visual C++ v6.0, .net will have already altered some system files which (as far as I know), are never removed and your system is permanently changed forever. Also, they aren't compatible with each other, I think that's been mentioned before though (Microsoft.... ppphhhhttt!!).
The void pointer error you're getting is a result of using .net architecture. If you're using Visual C++ v6.0 and still getting this error, off hand I would say it was because you had already previously installed .net onto your computer.  




I believe that is incorrect.

Though I am a hobbyist coder at best--and a damn poor one at that(just look at my site's coding)--the line of code in question is not a .Net Framework issue. It is a compiler issue wherein VC++6.0 allows some C++ ISO non-compliant code (C type) and VC++.Net does not.  

I have both VC++6sp5 and VC++.Net2002 (And VB6sp5 and Matrix and C#.Net) installed on my system. Using VC++sp5 I was able to compile every one of the scripts that come with the current SFC3 API without problem. It is in using VC++.Net to compile the scripts that one runs into errors.

Say what you will about MS--I'm sure that as the 800 pound gorilla they're used to it--I doubt this is their or anyone elses' fault, per se. It's just changes in compiler compliance that makes VC++.Net2002 useless for compiling scripts for an environment developed with VC++6.0.

Respectfully,
Jerry  

FPF_TraceyG

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #7 on: March 18, 2003, 07:59:59 pm »
Quote:

Quote:

If you've installed .net and then when back to Visual C++ v6.0, .net will have already altered some system files which (as far as I know), are never removed and your system is permanently changed forever. Also, they aren't compatible with each other, I think that's been mentioned before though (Microsoft.... ppphhhhttt!!).
The void pointer error you're getting is a result of using .net architecture. If you're using Visual C++ v6.0 and still getting this error, off hand I would say it was because you had already previously installed .net onto your computer.  




I believe that is incorrect.

Though I am a hobbyist coder at best--and a damn poor one at that(just look at my site's coding)--the line of code in question is not a .Net Framework issue. It is a compiler issue wherein VC++6.0 allows some C++ ISO non-compliant code (C type) and VC++.Net does not.  

I have both VC++6sp5 and VC++.Net2002 (And VB6sp5 and Matrix and C#.Net) installed on my system. Using VC++sp5 I was able to compile every one of the scripts that come with the current SFC3 API without problem. It is in using VC++.Net to compile the scripts that one runs into errors.

Say what you will about MS--I'm sure that as the 800 pound gorilla they're used to it--I doubt this is their or anyone elses' fault, per se. It's just changes in compiler compliance that makes VC++.Net2002 useless for compiling scripts for an environment developed with VC++6.0.

Respectfully,
Jerry    




Indeed... so, which compiler was our friend above using?

Captain Evans

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #8 on: March 19, 2003, 05:42:06 am »
I had the .NET framework installed to run a program (can't remember the one). I then installed MSVC++ 6.0 with sp5 and the DirectX SDK. I attempted to compile a script but got the above errors. So... I uninstalled the .NET framework and tried again. Still had the same result. So I commented out the line.

My OS is Win98.  

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #9 on: March 19, 2003, 06:15:43 am »
Quote:

I had the .NET framework installed to run a program (can't remember the one). I then installed MSVC++ 6.0 with sp5 and the DirectX SDK. I attempted to compile a script but got the above errors. So... I uninstalled the .NET framework and tried again. Still had the same result. So I commented out the line.

My OS is Win98.  




Hmmm...when I get a chance I'll see what happens on my son's ME OS and if I can reproduce that behavour. I'm skeptical that the cause is the .Net Framework.

Best,
Jerry  

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API
« Reply #10 on: March 19, 2003, 06:31:07 am »
check these out...not exactly on the nose, but interesting none the less:

 http://support.microsoft.com/default.aspx?scid=kb;en-us;292752
 http://support.microsoft.com/default.aspx?scid=kb;en-us;139825

Hope that helps.

Best,
Jerry  

Captain Evans

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API - **Update**
« Reply #11 on: March 19, 2003, 09:40:10 am »
I checked out those URLs ToastyO. I also did a search on InterlockedCompareExchange. Here is a snip of what I found on the MSDN site of Microsoft:

Quote:

The InterlockedCompareExchange function performs an atomic comparison of the specified values and exchanges the values, based on the outcome of the comparison. The function prevents more than one thread from using the same variable simultaneously.

If you are exchanging pointer values, this function has been superseded by the InterlockedCompareExchangePointer function.




So I went and changed this:

thisThreadOwnsTheOptex = (0 == ::InterlockedCompareExchange( (void**)&fSharedInfo.fLockCount, (void*)1, 0) );

To this:

thisThreadOwnsTheOptex = (0 == ::InterlockedCompareExchangePointer( (void**)&fSharedInfo.fLockCount, (void*)1, 0) );

And... it worked! All of the scripts compile without errors now. Just by adding the word Pointer.  But it seemed to good to be true so I tested it out by running the rebuilt script. The result was flawless.  

Thanks for all the help everyone.  

Toasty0

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API - **Update**
« Reply #12 on: March 21, 2003, 11:04:34 am »
Quote:

thisThreadOwnsTheOptex = (0 == ::InterlockedCompareExchangePointer( (void**)&fSharedInfo.fLockCount, (void*)1, 0) );






That change in the optex.cpp does help get past the pointer error but then causes linking errors...like a whole gaggle of linking errors.

hmmm................


Best,
Jerry  

Captain Evans

  • Guest
Re: Newbie Needs Help On Errors - SFC3 API - **Update**
« Reply #13 on: March 22, 2003, 07:21:33 am »
That is strange. All of my borg scripts in the Scrips_Borg.dsw workspace gave no errors or warnings after doing this. I even added all of the other borg projects (Borg_CommonFoe, Borg_Friends, Borg_Hunter, **Borg_TripWire, Borg_Life, Borg_Voices).

** Commented out the voices since I couldn't locate them.

I never got any linking errors.