|
|
Sorry, my bad englist...
Umm, your meaning is if the code is a instruction, unneed use Interlocked functions? it unable happen some question?
If "lock = 0" modification "if (0 == lock)", need Interlocked functions?
and i want let nether code safe in multithreading, how to do?
if (0 == lock)
{
lock = 1;
}
else
{
lock = 0;
}
Thanks very much for your answer.
|
|
|
|
|
Interlocked* is needed if you want to do 2 or more things with the value.
In your example:
if( 0 == lock ) lock = 1;
else lock = 0;
You are doing (at least) 2 things:
1. if( 0 == lock )
2. lock = ...;
Imagine 2 threads, Thread1 and Thread2.
Start with lock = 0.
Thread1 checks 1. above: if( 0 == lock ) and returns true
Thread2 then checks 1. above: if( 0 == lock ) and returns true
Thread1 then does 2. above: lock = 1
Thread2 then does 2. above: lock = 1
Problem: both threads think they are locked.
You must use Interlocked* to make it like 1 instruction (i.e. atomic):
InterlockedCompareExchange(&lock, 1, 0)
...cmk
Save the whales - collect the whole set
|
|
|
|
|
volatile bool Sentinel = true;<br />
<br />
unsigned ThreadFunc1( void* pArguments ) {<br />
while (Sentinel){;}<br />
<br />
......<br />
return 0;<br />
} <br />
<br />
unsigned ThreadFunc2( void* pArguments ) {<br />
Sentinel = false;
return 0;<br />
}
--------------------------------------------
Ago, i think if a thread readning a address, and other thread write this address, that will be conflict. But why above not happen error and crash.
you say "You are doing (at least) 2 things", but InterlockedExchange only 1 operation, how to use it.
underside is my some code, can u help me see is it safe?
1.
volatile LONG g_Value = -1;<br />
<br />
LONG Read()<br />
{<br />
......<br />
return InterlockedExchange(&g_Value, g_Value);<br />
}<br />
<br />
VOID Write(LONG NewValue)<br />
{<br />
......<br />
return InterlockedExchange(&g_Value, NewValue);<br />
}<br />
<br />
VOID Thread1()<br />
{<br />
if (Read >= 0)<br />
{<br />
Write(-1);<br />
<br />
for (INT i = 0; i < 10; i++)<br />
{<br />
Write(i);<br />
if (RunThread3() == error)<br />
{<br />
Write(-1);<br />
}<br />
}<br />
}<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
}
-----------------------------------------------------
2.
volatile LONG g_nIndex = -1;<br />
<br />
VOID Thread1()<br />
{<br />
InterlockedExchange(&g_nIndex, 1);<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
do<br />
{<br />
}<br />
while (InterlockedExchange(&g_nIndex, g_nIndex) < -1);<br />
}<br />
<br />
VOID Thread3()<br />
{<br />
INT nIndex = GetIndex();<br />
InterlockedExchange(&g_nIndex, nIndex);<br />
}
-----------------------------------------------------
3.
volatile LONG g_nData1 = 0L;<br />
<br />
VOID Thread1()<br />
{<br />
if (InterlockedExchange(&g_nData1, g_nData1) == 0)<br />
{<br />
InterlockedExchangePointer(&g_nData1, 1);<br />
}<br />
<br />
.................<br />
<br />
if (InterlockedExchangePointer(&g_nData1, g_nData1) == 1)<br />
{<br />
InterlockedExchangePointer(&g_nData1, 0L);<br />
}<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
}
-------------------------------------------------------
4.
volatile LONG g_bIsLock = 0L;<br />
<br />
VOID Thread1()<br />
{<br />
if (InterlockedExchange(&g_bIsLock, g_bIsLock) == 1)<br />
{<br />
InterlockedExchange(&g_bIsLock, 0L);<br />
}<br />
else<br />
{<br />
InterlockedExchange(&g_bIsLock, 1);<br />
}<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
InterlockedExchange(&g_bIsLock, g_bIsLock);<br />
}<br />
<br />
VOID Thread3()<br />
{<br />
if (InterlockedExchange(&g_bIsLock, g_bIsLock))<br />
{<br />
<br />
}<br />
}
Thanks very much for your help.
|
|
|
|
|
Your code does not make sense.
Do not use:
if( InterlockedExchange() ) {
InterlockedExchange();
}
This is bad, you are doing 2 things (test and set) in 2 instructions.
Instead use:
while( InterlockedCompareExchange(&lock, 1, 0) ) {
// lock was == 0, now == 1, 'this' thread set lock = 1
}
This is better, you are doing 2 things in 1 instruction.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Yes, my code not make sense, it only write example for my question.
Is nether code right now? Which Interlocked functions unneed?
1.
volatile LONG g_Value = -1;<br />
<br />
LONG Read()<br />
{<br />
return InterlockedExchange(&g_Value, g_Value);<br />
}<br />
<br />
VOID Write(LONG NewValue)<br />
{<br />
InterlockedExchange(&g_Value, NewValue);<br />
}<br />
<br />
VOID Thread1()<br />
{<br />
if (Read() >= 0)<br />
{<br />
Write(-1);<br />
<br />
for (INT i = 0; i < 10; i++)<br />
{<br />
......<br />
Write(i);<br />
<br />
if (RunThread2() == error)<br />
{<br />
......<br />
Write(-1);<br />
}<br />
}<br />
}<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
}
-----------------------------------------------------
2.
volatile LONG g_nIndex = -1;<br />
<br />
VOID Thread1()<br />
{<br />
InterlockedExchange(&g_nIndex, 1);<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
do<br />
{<br />
......<br />
}<br />
while (InterlockedExchange(&g_nIndex, g_nIndex) < -1);<br />
}<br />
<br />
VOID Thread3()<br />
{<br />
INT nIndex = GetIndex();<br />
<br />
InterlockedExchange(&g_nIndex, nIndex);<br />
}
-----------------------------------------------------
3.
volatile LONG g_nData1 = 0L;<br />
<br />
VOID Thread1()<br />
{<br />
InterlockedCompareExchange(g_nData1, 1, 0L);<br />
<br />
.................<br />
<br />
InterlockedCompareExchange(g_nData1, 0, 1);<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
}
-------------------------------------------------------
4.
volatile LONG g_bIsLock = 0L;<br />
<br />
VOID Thread1()<br />
{<br />
InterlockedCompareExchange(g_nData1, 0L, 1);<br />
}<br />
<br />
VOID Thread2()<br />
{<br />
if (InterlockedExchange(&g_bIsLock, g_bIsLock) == 0L)<br />
{<br />
......<br />
}<br />
}<br />
<br />
VOID Thread3()<br />
{<br />
if (InterlockedExchange(&g_bIsLock, g_bIsLock) == 1)<br />
{<br />
......<br />
}<br />
}
---------------------------------------------
And can u tell me why nether MSDN example unuseInterlocked functions, but it can work right and have not resource conflict( a thread read value, the other one write value)
volatile bool Sentinel = true;<br />
<br />
unsigned ThreadFunc1( void* pArguments ) {<br />
while (Sentinel){;}<br />
<br />
......<br />
return 0;<br />
} <br />
<br />
unsigned ThreadFunc2( void* pArguments ) {<br />
Sentinel = false;
return 0;<br />
}
|
|
|
|
|
|
HOW WHAT wrote: Unclear why those code run not happen error, if
if "volatile bool Sentinel = true;" -> "bool Sentinel = true;" , have some different?
http://msdn2.microsoft.com/en-us/library/12a04hfd(VS.80).aspx[^]
volatile is important.
It tells the compiler that the value could change any time.
e.g.
void Thread1( void )
{
while( Sentinal ) {
...
}
}
void Thread2( void )
{
...
Sentinal = false;
(wait for Thread1 to finish)
...
}
If Sentinal is NOT volatile then Thread1 may cache the value of Sentinal when the Thread1 starts and never reload it becuase it is not used anywhere else in Thread1 (it optimizes the load out). In the example above this could cause Thread2 to wait forever becuase Thread1 never exits.
If Sentinal IS volatile then Thread1 reloads the value in each iteration of the while loop.
Therefore when Thread2 changes Sentinal Thread1 will see the change.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
May i understand that it's real-time and not optimize code of all about this value?
|
|
|
|
|
I do not understand what you are saying.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
is there a libary or something where i can get numbers which have like 50 digits without truncation, for a program for find prime numbers etc???
also why i'm here
***************************************************
***************************************************
i'm trying to use the .clear() with vectors but they never work
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vectornumbers;
int createindex = 100;
while(createindex)
{
numbers.push_back(createindex);
createindex--;
}
cout << numbers[20] << endl;
numbers.clear();
cout << numbers[20] << endl;
system("PAUSE");
return 0;
}
what am i doing wrong?
thanks i'n advanced
|
|
|
|
|
g3RC4n wrote: what am i doing wrong?
Not using <pre> tags for one thing. The other thing is that your code snippet (i.e., adding to a vector) has nothing to do with your question (i.e., large numbers, primes).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote:
Not using <pre> tags for one thing.
|
|
|
|
|
can you just help me out?
|
|
|
|
|
google "large integer library c++"
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
|
I have this VBA code: (uses MS HTML library MSHTML.tlb)
Public ie As InternetExplorer
Sub RacingPost_Login()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
'Go to this Web Page!
ie.navigate "https://reg.racingpost.co.uk/cde/login_iframe.sd"
' (waits here for good connection)
With ie.document.forms(0)
.in_un.Value = "USERNAME"
.in_pw.Value = "PASSWORD"
.submit
End With
I would like to do this in C++. I've tried for 4+ days.
Any help is greatly appreciated.
Thanks,
Roy
|
|
|
|
|
baloneyman wrote: I would like to do this in C++. I've tried for 4+ days.
May I see what you've done in 4+ days?
|
|
|
|
|
Hi, Most of the attempts were erased. I was just using this stub to
plug things in.
I can get logged just by tagging the parameters to the url and doing
a navigate. But that way ends up at a splash screen which the VBA code
bypasses.
This one I think was from MSDN:
CString strHeaders =
_T("Content-Type: application/x-www-form-urlencoded");
CString strFormData = _T("in_un=xxx&in_pw=xxx&process=IN&PARGS=http%253A%252F%252Fwww.racingpost.co.uk%252Fnews%252Fhome.sd");
CInternetSession session;
CHttpConnection* pConnection =
session.GetHttpConnection(_T("https://reg.racingpost.co.uk/cde/login_iframe_rp.sd"));
CHttpFile* pFile =
pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, _T("rp_sign"));
BOOL result = pFile->SendRequest(strHeaders,
(LPVOID)(LPCTSTR)strFormData, strFormData.GetLength());
The form is:
<FORM name=rpsign onsubmit="rp_sign(document.rpsign);return false"
method=post>
<TBODY>
<TR vAlign=top height=25>
<TD width=114 colSpan=2><INPUT class=B10 maxLength=30 size=14
value=xxx name=in_un></TD>
<TD width=136 colSpan=2><INPUT class=B10
style="BACKGROUND-IMAGE: url(../images/furniture/top_password.gif); BACKGROUND-REPEAT: no-repeat"
onfocus=removeBG(this); type=password maxLength=30 size=14 name=in_pw
xonFocus="this.backgroundimage:url('../images/furniture/top_password.gif');"></TD></TR>
<TR>
<TD width=52><INPUT class=A8 style="WIDTH: 52px" onclick="rp_sign(document.rpsign);return false" type=submit value="LOG IN"></TD>
<TD width=62><INPUT class=A8 style="WIDTH: 62px" onclick="rp_register(document.rpsign);return false" type=button value=REGISTER><INPUT
type=hidden value=IN name=process><INPUT type=hidden
value=http%3A%2F%2Fwww.racingpost.co.uk%2Fnews%2Fnews_service.sd%3Fstyle%3D2
name=PARGS></TD>
<TD width=126><INPUT class=A8 style="WIDTH: 126px" onclick="rp_forgotten(document.rpsign);return false" type=button value="FORGOTTEN PASSWORD"></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
I am not too much when it comes to HTTP
Thanks,
Roy
|
|
|
|
|
hi, i know how to display database(.mdb) in a list control .But how to copy selected records in the list control into another table(in .mdb file) with the column ~field
Thanks
|
|
|
|
|
hero1995 wrote: But how to copy selected records in the list control into another table...
Break this up into at least two smaller problems. Work on those individually.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Do anyone know the steps to use PlaySound to play a wave file by using Add resource MFC VC++ 2003?
Am using a button to play a wave file.
Can someone provide a step by step guide.
Thanks in advance
|
|
|
|
|
YUANGE wrote: Do anyone know the steps to use PlaySound to play a wave file by using Add resource...
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am trying to use tiff.lib generated from cxImage project (I just compiles tiff project to generate just tiff.lib) and then linked it in my project and included the necessary header files. While building my project it gives the following errors..
Tiff.lib(tif_lzw.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_fax3.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_dirread.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_dirwrite.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_write.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_luv.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_aux.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_read.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_dirinfo.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_compress.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
14BitImageCreator.obj : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_getimage.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_dir.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
Tiff.lib(tif_open.obj) : error LNK2001: unresolved external symbol __TIFFmalloc<br />
14BitImageCreator.obj : error LNK2001: unresolved external symbol _TIFFOpen<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_lzw.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_write.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_luv.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_fax3.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_dirinfo.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_compress.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_dirread.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_dirwrite.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_close.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_getimage.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_dir.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_read.obj) : error LNK2001: unresolved external symbol __TIFFfree<br />
Tiff.lib(tif_getimage.obj) : error LNK2001: unresolved external symbol __TIFFmemcmp<br />
Tiff.lib(tif_dirwrite.obj) : error LNK2001: unresolved external symbol __TIFFmemcmp<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_next.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_packbits.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_dumpmode.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_dirread.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_dirwrite.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_fax3.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_getimage.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_dir.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_aux.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_read.obj) : error LNK2001: unresolved external symbol __TIFFmemcpy<br />
Tiff.lib(tif_luv.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_fax3.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_lzw.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_getimage.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_dir.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_open.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_write.obj) : error LNK2001: unresolved external symbol __TIFFmemset<br />
Tiff.lib(tif_error.obj) : error LNK2001: unresolved external symbol __TIFFerrorHandler<br />
Tiff.lib(tif_warning.obj) : error LNK2001: unresolved external symbol __TIFFwarningHandler<br />
Tiff.lib(tif_dirinfo.obj) : error LNK2001: unresolved external symbol __TIFFrealloc<br />
Tiff.lib(tif_write.obj) : error LNK2001: unresolved external symbol __TIFFrealloc<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol __TIFFrealloc<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _inflateInit_<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _inflateReset<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _inflateSync<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _inflate<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _deflateInit_<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _deflateReset<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _deflate<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _deflateEnd<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _inflateEnd<br />
Tiff.lib(tif_zip.obj) : error LNK2001: unresolved external symbol _deflateParams<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_CreateDecompress<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_CreateDecompress<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_std_error<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_std_error<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_abort<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_abort<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_resync_to_restart<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_resync_to_restart<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_header<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_header<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_start_decompress<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_start_decompress<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_reset_huff_decode<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_finish_decompress<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_finish_decompress<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_scanlines<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_scanlines<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_raw_data<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_read_raw_data<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_alloc_huff_table<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_alloc_quant_table<br />
Tiff.lib(tif_ojpeg.obj) : error LNK2001: unresolved external symbol _jpeg_destroy<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_destroy<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_CreateCompress<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_set_defaults<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_set_quality<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_suppress_tables<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_write_tables<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_set_colorspace<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_start_compress<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_write_scanlines<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_write_raw_data<br />
Tiff.lib(tif_jpeg.obj) : error LNK2001: unresolved external symbol _jpeg_finish_compress
I made sure that both projects are set to /MTd option...
Any ideas/suggestions?? All I wanna do is to read any tiff file and get the contents of the image data... thats all...
thanks...
Pavan
|
|
|
|
|
Disclaimer: I have no clue what CxImage is but those link errors are pretty common when forgetting about to tell the linker about the .lib file.
Underneath your "#include" statements for the library, don't forget to include a pragma for it. Also, make sure the .lib file is in your paths or at least in your project directory when linking.
#pragma comment(lib, "Tiff") // If .lib file is called Tiff.lib
|
|
|
|