PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Compilation Errors

hello,
while reading and experementing with phantoms tutorials i've ran into trouble compiling the code [using eVc], i get mostly casting errors such as "error C2440: 'initializing' : cannot convert from 'unsigned short' to 'unsigned short *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast", "error C2296: '>>' : illegal, left operand has type 'unsigned short *'" or "error C2110: cannot add two pointers"
what is wrong?
Wich tutorial are you referring to?
Oh and register. :) This is a cool place with cool people, so you might want to come back some day. :)
actually i do come back every day for awhile now, took me some time to find this website/forum which i think is a great source of information, i'll take the chance now also to thank you for your major contribution :)

the tutorial i reffer to is number two, the tga reading function and Image mixing...
Name :),

There is an error in that tutorial, indeed. In the last block of code, wich reads

unsigned short* p1 = *(buffer + x + y * 320);
unsigned short* p2 = *(buffer + x + (319 - y) * 320);

you should remove the '*' after 'short' on both lines. We are not creating pointers to the pixels, but we are storing the pixels themselves in two variables named p1 and p2.

If you get any other errors, please let me know. Also, be aware that this source is intended to be used in EVC; I don't think Visual C will like the 'unsigned short' strings.

- Jacco.
Registered ;)

the source compiled successfuly :)
Ouch :\
got a 'Fatal Application Error' when trying to run it on ppc with following information:
'Exception: 0xc000005, Address: 0013022WierdSquare'
Aw, there's another error in the text. Everywhere you see '* 320', this should read '* 240', since the display is 240 pixels wide. After these modifications, it should work. I will upload the fixed tutorial tomorrow.
BTW, I believe this is the only tutorial that I did code for that I didn't test. :) All other tutorials *should* have code that I cut/pasted from actually working demos.
Sorry for the inconvenience.
program compiled and ran, but all it did is blackout the screen.
cant escape it too so i'll have to wait until machine shutsdown [soft reset only loads last operation in range of 5minutes]

might it have something to do with getting the warnning:
warning C4129: 'i' : unrecognized character escape sequence
for the line of code:
loadtga( _T(".\image.tga"), 240, 320, buffer );
meanning it couldnt open the file and thus just displays null?
i'll try and add error handling to file and image type after my ppc loads ok.
by the way i also got the following warnning:
warning C4244: '=' : conversion from 'long' to 'unsigned short', possible loss of data

Ehm yes, that should be .\\image, if that's where the image is located. Otherwise it thinks 'i' is a special character, just like \n. Why didn't anyone spot these errors before? :) Does anyone actually take the time to try this stuff?! ;)
still blackouts :(
correct me if i'm wrong but if the functino is defined:
void loadtga( unsigned short* file, int w, int h, PIXEL* dest )
shouldnt the width and hieght be oposite to what's writen here:
loadtga( L"\\My documents\\image.tga", 240, 320, buffer ); ?
ack sorry my mistake :)
old habbit from PC coding where the width is larger then the hieght in oposite to ppc.

anyhow found the problem, apperently using '.\\' is invalid and instead a full path length should be specified.

Right, Windows CE does not have a "current working directory", so relative paths are not supported. The closest you can get is to extract the path of the module's file name (the current running executable) and use it as the base dir for data files, etc. At least with that technique the end user can install the program wherever they like.

Dan East
GetModuleFileName is the exact API function to use to get the full path and filename of the running exe.

Dan East
cool thanks!

by the way when trying to move the update() function out of the loop [of twicking the image] in-order to make it load faster the application breaks with fatal error, what's the reason?
I don't know why it's crashing in that case, it shouldn't. :) About the relative path: In one of the more recent tutorials (6, I believe) there is a function that returns the full path if you pass it a filename, or filename + subdir relative to the application. It comes in both a char and lchar version. Quite handy. You might want to check that one out.
Not registered - give me · 17 Oct 2001, 11:02 UTC
The same problem. On the emulator and VC6.0 the same problem. Strange, but when i replaced 240 and 320 in the for () loops for x and y, there is not problem.
I don't know why? Maybe EasyCE works not correct under emulation?

cool thanks!

by the way when trying to move the update() function out of the loop [of twicking the image] in-order to make it load faster the application breaks with fatal error, what's the reason?