|
Please delete previous message its not good idea write a message without title and do you have any questions?
|
|
|
|
|
Hi,
I am working in a project in VC++ using MFC and recently while building and linking the project I get warnings like:-
Airways.obj : warning LNK4006: "unsigned short DBP_NWPT_LON_SB" (?DBP_NWPT_LON_SB@@3GA) already defined in Airport.obj; second definition ignored
Initially i ignored this warning but as the lines of code increased beyond 3000 so was the amount of warnings that I get...
Can anyone plz help me in resolving these warnings?? I am in dire need of getting rid of them as i hav to finish my proj this week...
Thanks..
Shiva Priya
|
|
|
|
|
no I don't hav a second definition..thats the prob naa..
unsigned short DBP_NWPT_LON_SB;
this is the only declaration...somewhere it is getting included twice though i hav put the definition #ifndef...#endif statement..
u know any other reason due to which it gets included more than once??
Thnx..
Priya.
|
|
|
|
|
I guess you have declared this variable in two cpps .
Otherwise, I dont see any reason for this error.
|
|
|
|
|
have you considered usingt the extern keyword ?
|
|
|
|
|
shivapriyak wrote: no I don't hav a second definition..thats the prob naa..
unsigned short DBP_NWPT_LON_SB;
this is the only declaration.
Actually that is both a declaration and a definition. You use the extern keyword to make it just a declaration. i.e.
extern unsigned short DBP_NWPT_LON_SB;
This is what toxcct was alluding to above.
Steve
|
|
|
|
|
When you compile a .cpp file (or a .c file) an .obj file is produced. The linker links all these .obj files together to produce the finished program. Your error message means that the file "Airways.cpp" (or "Airways.c", I can't be sure) contains a definition of DBP_NWPT_LON_SB and so does the file "Airport.cpp" (or "Airport.c", I can't be sure). The linker knows; this is the case.
Steve
|
|
|
|
|
Hi,
I am new to VC++ and i am currently working on a project in VC++.
I keep getting the error LNK 2001:unresolved external symbol "double __cdecl ut_asin(double)"
I get this error only while linking..not during complilation!!
I have a declaration as:
double ut_asin( double a );
whose definition is given in math.h
Can anyone help me to resolve this error??
Thanks,
Shiva Priya.
|
|
|
|
|
shivapriyak wrote: double __cdecl ut_asin(double)"
Where it is defined ? Linked is not able to find it.
|
|
|
|
|
Thnx for the immediate reply..
see i hav a file as ut_math.h in which the math.h file is included...
This file has macros like:
#define mqerASN ut_asin
#define fasin ut_asin
Now, I have included ut_math.h in a file called as Common_func.cpp where this method is used as:
DDIST_B = ut_asin( DDIST_SIN_ANG_SIN_RATIO * sin( DABS_ANG_B ) ) * FIXED_EARTH_RAD;
This is what I have done and I started getting the linking error.I hope you got my prob.
Thnx
Shiva Priya.
|
|
|
|
|
You have not answered question , where is ut_asin is defined ?
|
|
|
|
|
double ut_asin( double a )
{
if( fabs(a) < 1.0 )
return asin(a);
else if( fabs(a) < 1.00001 )
return (double)(mqerSGN( asin((double)1.0), a));
}
this is the definition of ut_asin in a file called as ut_math_e.cpp
thnx,Priya
|
|
|
|
|
shivapriyak wrote: ut_math_e.cpp
Does this this file is included in project and compiling ?
|
|
|
|
|
shivapriyak wrote: this is the definition of ut_asin in a file called as ut_math_e.cpp
Is ut_math_e.cpp being compiled?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
shivapriyak wrote: I have a declaration as:
double ut_asin( double a );
whose definition is given in math.h
Can you explain more in detail what you mean by that ? I never heard about a function called ut_asin in the math library (I might be wrong this looks strange to me).
What did you do exactly ?
You probably provided yourself a function prototype and forgot to define the body of the function. Can you post some relevant code (and don't forget to use the pre tags)
|
|
|
|
|
Thnx for the immediate reply..
see i hav a file as ut_math.h in which the math.h file is included...
This file has macros like:
#define mqerASN ut_asin
#define fasin ut_asin
Now, I have included ut_math.h in a file called as Common_func.cpp where this method is used as:
DDIST_B = ut_asin( DDIST_SIN_ANG_SIN_RATIO * sin( DABS_ANG_B ) ) * FIXED_EARTH_RAD;
This is what I have done and I started getting the linking error.I hope you got my prob.
Thnx
Shiva Priya.
|
|
|
|
|
|
You got to understand that compiling and linking are different things and steps in building a program.
I think you got to include the lib, I guess the "math.lib" in your project settings.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: I think you got to include the lib, I guess the "math.lib" in your project settings.
Doubtful, since ut_asin() is his own function.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
I am creating a challenge response application and in that making a call to encrypt a buffer that looks like
PBYTE pBufPtr
if(!Encrypt(hKey, 0, TRUE, 0,(BYTE *)pBufPtr, &dwCount, dwBufferLen))
In this case I want to take the encrypted data pBufPtr and display it as a string to the user. So any suggestions on how I can convert the pBufPtr into a decimal number or string that can be displayed to the user for typing purposes.
Also the decimal or string value obtained by converting the pBufPtr needs to be converted back into the encrypted data for the response side of the application.
So I need to convert encrypted data into string/decimal/BCD and take that string/decimal/BCD and convert it back into the encrypted data buffer.
So please let me know how is this possible. Thank you.
vg
|
|
|
|
|
Are you asking for a encryption/decription routine, or how to convert a byte pointer to something displayable ?
|
|
|
|
|
I am asking to convert the encrypted byte data to something displayable. The encrypted data looks like
"Œ[Ü‹¼| £](%Î݇X/2A9›Žf˜Qvdýýýý««««««««îþîþ"
so it has symbols such as ««««««« %
how do I convert the this binary data into something displayable so that it can be displayed on the screen for the user to read it.
The idea is to create a challenge by encrypting the data.
2) This encrypted data user reads it out from the a dialog in some displayable form(this part I need help on)
3) That converted encrypted data is converted back to its binary form and used to create the response.
vg
|
|
|
|
|
vgandhi wrote: In this case I want to take the encrypted data pBufPtr and display it as a string to the user. So any suggestions on how I can convert the pBufPtr into a decimal number or string that can be displayed to the user for typing purposes.
Also the decimal or string value obtained by converting the pBufPtr needs to be converted back into the encrypted data for the response side of the application
The simplest thing to do is to convert each byte of the encrypted data into two hexidecimal characters, so that a byte of the value of 'z' becomes the string of two characters: '7A' , and you can extend this to each byte of encrypted data. I.e 'ijk123' becomes '696A6B313233' .
If the encrypted data is of fixed length, for example, it will always be 10 characters of encrypted data, you can render it to hexidecimal and back again using functions like sprintf(...) and sscanf(...) .
::sprintf( "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
btaEncData[ 0 ], btaEncData[ 1 ], btaEncData[ 2 ], btaEncData[ 3 ],
btaEncData[ 4 ], btaEncData[ 5 ], btaEncData[ 6 ],
btaEncData[ 7 ], btaEncData[ 8 ], btaEncData[ 9 ] );
::sscanf( cpHexData, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
&btaEncData[ 0 ], &btaEncData[ 1 ], &btaEncData[ 2 ], &btaEncData[ 3 ],
&btaEncData[ 4 ], &btaEncData[ 5 ], &btaEncData[ 6 ],
&btaEncData[ 7 ], &btaEncData[ 8 ], &btaEncData[ 9 ] ); That is a simple example, and not the most optimal, but it should give you the general idea.
You can reduce the amount of data the user has to type by converting the encrypted data buffer into blocks of 32-bit values (DWORD s) or 64-bit values (hyper s), and using a function like ultoa(...) or _ui64toa(...) with a higher radix to reduce number of characters but use a wider range of them, and use the corresponding ato*(...) functions to convert them back.
ultoa( 0xFFFFFFFF, caBuffer, 10 );
ultoa( 0xFFFFFFFF, caBuffer, 16 );
ultoa( 0xFFFFFFFF, caBuffer, 36 ); Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Dear James,
Say I use the following
ultoa( 0xFFFFFFFF, caBuffer, 10 ); and the value I get is "4294967295"
Now how would I conver the 429496... number back into the original caBuffer form after making the above call.
Please let me know.
Thanks
vg
|
|
|
|
|
vgandhi wrote: Now how would I conver the 429496... number back into the original caBuffer form after making the above call.
As i said, the ato*(...) functions - for example, if you use ultoa(...) to convert to string (ltoa == long to ascii/ANSI), you can use the atol(...) to get it back to a number (atol == ASCII/ANSI to long).
If you look up those functions, you will see that there is no atoul(...) function - but you will find the strto*(...) functions. In this example, strotul(...) will convert it back.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|