|
|
|
This is sad, but I understand how you are feeling.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi, I have only recently got back to VC++ programming and I was only a rookie when I used to program in it but now I need to create an application that can list all the devices attached to the system like "devcon.exe" does. I only just started coding it and I'm now facing a linker error that I just can't resolve! The path to my SETUPAPI.h file exists in the "Directories" under options. And I'm only calling the "SetupDiGetClassDevsEx" function. The program compiles fine but gives the following error while linking:
DeviceMDlg.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsExA@24
Debug/DeviceM.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
DeviceM.exe - 2 error(s), 0 warning(s)
Please help! I'm losing my mind!
Thanks and sorry if it's a really stupid question
*** What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
modified on Friday, June 5, 2009 12:36 AM
|
|
|
|
|
You should add SetupAPI.lib to the linker input files list.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm sorry if I didn't specify it earlier but please look at the extra detail I've added to the end. Is there anything else I need to do too?
|
|
|
|
|
I've also noticed something now. MSDN shows that SetupDiGetClassDevsEx accepts 7 parameters but I guess VC++6.0 uses an older version as the SetupAPI.h header file in the default path(~/VC98/include) accepts only 6 parameters. So I tried to use the header and lib files available with Windows DDK which has SetupDiGetClassDevsEx with 7 params. But the two seem incompatible as now it shows me 37 errors at compile time, all in the header SetupAPI.h. Any help about how to handle this?
|
|
|
|
|
callousfantom wrote: What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
You should explicitely add SetupAPI.lib to the list of the linker input files (I suppose it is in Project Menu->Settings , Link tab, Category->General->Object/library )
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks!
|
|
|
|
|
How to load and display an image in C++?
|
|
|
|
|
#include "AtlImage.h"
cImage m;
m.Load(_T("C:\\1.jpg"));
m.BitBlt(0,0,640,480);
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Thanks for ur reply. I hv a query
is it a standard lib?? Can i hv cod using std. lib. only?
|
|
|
|
|
shyampasari wrote: Can i hv cod using std. lib. only?
Do you pay for each keystroke?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
what about CImage (and related stuff) ?
This signature was proudly tested on animals.
|
|
|
|
|
How to include it on MS Visual C++??
|
|
|
|
|
More information would have been very useful. What type of image is this (bmp, jpg, ...) ? How do you need to display this image ?
|
|
|
|
|
I need to display a grayscale image as i m working on eigenfaces for face recognition
|
|
|
|
|
Great, but what about the questions I actually asked ?
|
|
|
|
|
It depends below.
1) what type is that image
2) what is the display device
3) what platform or os do you use
4) what do you plan to use library for image processing
fro example,
1') windows 24 colored bitmap
2') windows crt screen
3') win32 platform
4') use simply win32 GDI api
You can write codes with above condition. It is very ordinary image processing but coding is a bit messy. MSDN tells you some sample codes kindly.
And also
4'') you can buy some image processing library
Paying usually makes you easier to write codes.
|
|
|
|
|
I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...
#include<stdio.h>
#include<conio.h>
#pragma pack(2)
typedef struct
{
unsigned short int type;
unsigned int size;
unsigned short int reserved1,reserved2;
unsigned int offset;
}HEADER;
typedef struct
{
unsigned int size;
int width,height;
unsigned short int bits;
unsigned int compression;
unsigned int imagesize;
int xresolution,yresolution;
unsigned int ncolors;
unsigned int impcolors;
}INFOHEADER;
typedef struct
{
unsigned int R,G,B;
}PIXEL;
void main()
{
HEADER headfirst;
INFOHEADER headsecond;
PIXEL pix;
FILE *fin,*fout,*f1;
char *read;
int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
float Y[256];
fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
if(fin==NULL)
{
printf("Error");
exit(0);
}
fread(&headfirst,sizeof(headfirst),1,fin);
if(headfirst.type!=19778)
{
printf("Not BMP");
getch();
return(0);
}
printf("Header %x ",headfirst.type);
printf("%u ",headfirst.size);
printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
printf("%u\n",headfirst.offset);
fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
fread(&headsecond,sizeof(headsecond),1,fin);
printf("IFD %u",headsecond.size);
printf("%d %d %u %u %u %d %d %u %u\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
if(fin==0)
{return(0);
}
for(i=0;i<headfirst.offset;i++)
{
ch=getc(fin);
}
i=0;
while ((ch=fgetc(fin))!=EOF)
{
mat[i]=(int)ch;
i++;
}
fclose(fin);
printf("Blue Plane\n");
i=0,j=0;
while(i<768)
{
B[j]=mat[i];
printf("%3d ",mat[i]);
i=i+3;
j++;
}
printf("\n\n");
printf("Green Plane\n");
i=1,j=0;
while(i<768)
{
G[j]=mat[i];
printf("%3d ",mat[i]);
i=i+3;
j++;
}
printf("\n\n");
printf("Red Plane\n");
i=2,j=0;
while(i<768)
{
R[j]=mat[i];
printf("%3d ",mat[i]);
i=i+3;
j++;
}
printf("\n\n Gray Scale Image\n");
for(i=0;i<256;i++)
{
Y[i]=0.2989 * R[i] + 0.5870 * G[i] + 0.1140 * B[i] ;
G[i]=(int)Y[i];
printf("%3d ",G[i]);
}
fout=fopen("C:/Dev-Cpp/1.bmp","wb+");
fwrite(&headfirst,sizeof(headfirst),1,fout);
fout=fopen("C:/Dev-Cpp/1.bmp","wb+");
fwrite(&headsecond,sizeof(headsecond),1,fout);
fout=fopen("C:/Dev-Cpp/1.bmp","wb+");
for(i=0;i<255;i++)
{
read[i]=(char)G[i];
}
read[i]='\0';
for(i=0;i<255;i++)
{
fwrite (read,sizeof(G),1,fout);
}
getch();
}
|
|
|
|
|
What is the misbehaviour?
Please be specific in your posts.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The code does not execute... The image is read right to left i believe, not left to right
|
|
|
|
|
Mitesh Karwa wrote: The code does not execute...
Mitesh Karwa wrote: The image is read right to left i believe, not left to right
The above behaviours looks quite incompatible...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm afraid I did not get you...
Actually, I could not get the image written on the file I meant to. So, the code does not execute.
And I am also doing the same thing in MATLAB. I got the pixel values there using imread command. On comparing, i found that the image is being read right to left. That was also my question... does imread read the image from right to left...
Hope I am being clearer now. Please help me
|
|
|
|
|
There is a not of stuff on the web showing how to load a bitmap file, see, for instance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|