PocketMatrix forums

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

Newbie needs help with VisualC++ and EasyCE 1.6

Hi!
I figured a good way to learn Visual C++ is with EasyCE 1.6 - then again, I'm mad! :P
I will be buying a pocket PC soon but for now just want to compile using the PC library and test it on the PC.
I have figured out how to open the workspace file and it compiles and runs (but only after I copy the two PC .dll files into the DEBUG folder).
Am I doing this part right - or am I missing something..
Next question - when I change the options in C++ to make a RELEASE build - it stops compiling - what can I do to get this to work?
Answers really appreciated as this is stopping me from USING and LEARNING easyce and visual C++

please email here or stevenmcd@hotmail.com thanks.
really appreciate any responses!
What errors do you get when you try to build with the Release config?

Dan East
Mr Plant · 20 Feb 2002, 02:36 UTC — More Info
Hi!

I am slowly getting my head around this!

Do I have this set up correctly?
I have a folder on my desktop called EasyCE 1.6 (as downloaded).

Ok - in debug mode - I double click the easyce.dsw file and it fires up VisualC++ with the project open.
Build - Rebuild All - works and generates a Debug folder with the easyce.exe file in it. I try to run this from the desktop but it won't run - I need to dump into the folder the files ptc.dll and hermes.dll - then it runs! success!

So far - have I got things set up ok?

It works anyway and it runs.

Next - I change the configuration to "Release mode" and click on rebuilt all again.

I get an 102 errors!
Linking...
EasyCE.obj : error LNK2001: unresolved external symbol _ptc_format_destroy@4
EasyCE.obj : error LNK2001: unresolved external symbol _ptc_surface_create@12
EasyCE.obj : error LNK2001: unresolved external symbol _ptc_console_create@0

etc. etc.

I worked out if I go into project settings - Link -
Object/Library modules and add to it "ptc.lib winmm.lib" (which I got my looking at that same line in the DEBUG version!), that it compiles a bit better!
Now I get:

Deleting intermediate files and output files for project 'easyce - Win32 Release'.
--------------------Configuration: easyce - Win32 Release--------------------
Compiling...
adler32.c
compress.c
crc32.c
deflate.c
gzio.c
infblock.c
infcodes.c
inffast.c
inflate.c
inftrees.c
infutil.c
trees.c
uncompr.c
zutil.c
EasyCE.cpp
sample.cpp
Linking...
LINK : fatal error LNK1181: cannot open input file "ptc.lib"
Error executing link.exe.

easyce.exe - 1 error(s), 0 warning(s)

What am I doing wrong here?
My other question is - how come the project file isn't already set up to "just compile" for release mode as well?
I'd learn a lot from your reply to these two questions!

Thanks.
In Visual C, press ALT-F7 (that's projects-settings). Go to the 'link' tab and select the 'input' category. In the 'additional library path' field, enter: OpenPTC/library/visual (I believe that's the dir where ptc.lib is, you may want to check that). Next, in the 'object/library modules' field, add 'ptc.lib'. Now compile and run.
Mr Plant · 20 Feb 2002, 10:27 UTC — Almost!
Hi! I did as you said - and its went from 102 errors to just 2!
This is what I get now (under release mode).

Linking...
EasyCE.obj : error LNK2001: unresolved external symbol __imp__sndPlaySoundA@8
Release/easyce.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

easyce.exe - 2 error(s), 0 warning(s)

Any idea what I need to add to fix this?

Thanks.
Ah yes, the sound stuff. Well at the same spot where you added ptc.lib, add winmm.lib and all should go well.
Mr Plant · 20 Feb 2002, 10:57 UTC — Worked! Last query!
It worked!

Linking...
LINK : warning LNK4089: all references to "GDI32.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "WINMM.dll" discarded by /OPT:REF

easyce.exe - 0 error(s), 2 warning(s)

Do I just ignore those warnings?
Yeah, just ignore those. I have no idea how to prevent these.
Sorry to take peoples time up here but one more question if I may.

I am following the tutorials and am trying to load in a TGA file and display it on screen.
As instructed, I have included this code at the correct place in my program:


#include "easyce.h"

void loadtga( unsigned short* file, int w, int h, PIXEL* dest )
{
DWORD size = w * 2 * h + 20, bytesread;
BYTE* tgabuff = new BYTE[size];
HANDLE tga = CreateFile( file, GENERIC_READ, FILE_SHARE_READ,
0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );
ReadFile( tga, tgabuff, size, &bytesread;, 0 );
CloseHandle( tga );
unsigned short* src = (unsigned short*)tgabuff + 9 + (h - 1) * w;
unsigned short* dst = (unsigned short*)dest;
for ( int i = 0; i < h; i++ )
{
for ( int x = 0; x < w; x++ )
{
int red = (*(src + x) & (31 << 10)) >> 10;
int green = (*(src + x) & (31 << 5)) >> 5;
int blue = *(src + x) & 31;
*(dst + x) = (red << 11) + (green << 6) + blue;
}
dst += w;
src -= w;
}
delete tgabuff;
}

void main()
{main code here}

Problem is - this gives this error:

C:\Documents and Settings\Steven McDonald\Desktop\EasyCE 1.6 (Custom)\Rock Crush 2002 - Project Files\RC2002.cpp(10) : error C2664: 'CreateFileA' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

RC2002.exe - 1 error(s), 0 warning(s)

Something to do with C versus C++ ??
Anyone know how to fix?
Thanks.
If you're using EasyCE2.0, you don't have to use that tgaload function. EasyCE2.0 can load from a tga file directly to a surface:

Code:

ASurface myimage( "myimage.tga" );


That's by far the easiest way. If you're using 1.6, you can still use the build-in tga loader, but the syntax is different (check easyce.h for details).
Chirper9 · 25 Aug 2003, 19:28 UTC — Will prevent link warning from being displayed
Mr Plant wrote:
It worked!

Linking...
LINK : warning LNK4089: all references to "GDI32.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "WINMM.dll" discarded by /OPT:REF

easyce.exe - 0 error(s), 2 warning(s)



Go to Projects->Settings and click on the Link tab in the field Object/library modules: paste this at the beggining /IGNORE:4089
That's useful advice. However I doubt the poster will see it as this thread was over a year old. :)

Dan East