Click to See Complete Forum and Search --> : How to use CxImage


Cooker
December 19th, 2004, 03:23 AM
Hi,
I download the CxImage project from web(http://www.xdp.it/projects.htm).
I compile the jpeg projet and CxImage project to get the jpeg.lib and cximage.lib.
I include the all header file in CxImage project , jpeg.lib and cximage.lib.
Write the following source:

#include <windows.h>
#include "ximage.h"
#pragma comment(lib,"CxImage.lib")
#pragma comment(lib,"jpeg.lib")


int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
CxImage image;

// bmp -> jpg
image.Load("C:\\image.bmp", CXIMAGE_FORMAT_BMP);
if (image.IsValid())
{
if(!image.IsGrayScale()) image.IncreaseBpp(24);
image.SetJpegQuality(70);
image.Save("C:\\image.jpg",CXIMAGE_FORMAT_JPG);
}

return 0;
}

and get the error

c:\program files\microsoft visual studio\myprojects\cximage\xfile.h(52) : error C2061: syntax error : identifier 'CxFile'
c:\program files\microsoft visual studio\myprojects\cximage\xfile.h(52) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\myprojects\cximage\xfile.h(53) : error C2449: found '{' at file scope (missing function header?)
c:\program files\microsoft visual studio\myprojects\cximage\xfile.h(74) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\myprojects\cximage\xmemfile.h(7) : error C2061: syntax error : identifier 'CxMemFile'
c:\program files\microsoft visual studio\myprojects\cximage\xmemfile.h(7) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\myprojects\cximage\xmemfile.h(7) : error C2059: syntax error : ':'
c:\program files\microsoft visual studio\myprojects\cximage\ximage.h(127) : error C2061: syntax error : identifier 'CxImage'
c:\program files\microsoft visual studio\myprojects\cximage\ximage.h(127) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\myprojects\cximage\ximage.h(128) : error C2449: found '{' at file scope (missing function header?)
c:\program files\microsoft visual studio\myprojects\cximage\ximage.h(645) : error C2059: syntax error : '}'
Error executing cl.exe.

main.obj - 11 error(s), 0 warning(s)

I would like to conversion between bmp and jpeg.
What shall I do to complete the project???
Thank you! :)

AcidBurnX
January 5th, 2005, 05:00 PM
Hi,

you have to rename your "main.c" to "main.cpp" because the C-Compiler cannot handle classes (which are used in the CxImage library). You must use C++.

After doing that you'll get a lot of linker errors .... Don't ask me how to fix them :-(

Hope it helps
AcidBurnX

Cooker
January 5th, 2005, 08:54 PM
Hi,

you have to rename your "main.c" to "main.cpp" because the C-Compiler cannot handle classes (which are used in the CxImage library). You must use C++.

After doing that you'll get a lot of linker errors .... Don't ask me how to fix them :-(

Hope it helps
AcidBurnX
Hi,
I would like to use CxImage library in c program.
I don't know how to include the library and use them.
Could someone give me some guide???
Thank a lot!

Ejaz
January 8th, 2005, 06:01 AM
I think you should go through the followings.

Mixed-Language Programming: Overview (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_mixed.2d.language_programming.3a_.overview.asp)
Programming with Mixed Languages (http://h18009.www1.hp.com/fortran/docs/vf-html/pg/pgwpmixl.htm)

Surely google will give you much more.

Cooker
January 9th, 2005, 04:31 AM
I think you should go through the followings.

Mixed-Language Programming: Overview (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_mixed.2d.language_programming.3a_.overview.asp)
Programming with Mixed Languages (http://h18009.www1.hp.com/fortran/docs/vf-html/pg/pgwpmixl.htm)

Surely google will give you much more.
Thank you!
In addition,I need someone tell me how to use CxImage library???
Could someone give me some suggestions or share your experience???
Thank a lot! :)