473,329 Members | 1,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,329 software developers and data experts.

char* misinterpreted as int* and Linker Error

1
Hi everybody!
I'm using Visual Studio 2005 and don't know how to solve this problem. Till now, everything worked just fine, included all the necessary libs, headers and so on.

But there is the problem:
I have to implement a class ColorSpaces with static member functions, which manipulates a buffer from the class MSImage and returns it.

ColorSpaces.h looks like this:
Expand|Select|Wrap|Line Numbers
  1. class ColorSpaces
  2. {
  3. public:
  4.     ColorSpaces();
  5.     virtual ~ColorSpaces(void);
  6.  
  7.     // returns a buffer, where the L,a,b values of a given MSImage are stored
  8.     static char* calculateLab(MSImage* image);
  9.     static char* calculateLuv(MSImage* image);
  10.     static char* calculateRG(MSImage* image);
  11.  
  12. };
ColorSpaces.cpp does nothing much till now, but looks like this:
Expand|Select|Wrap|Line Numbers
  1. ColorSpaces::ColorSpaces()
  2. {
  3. }
  4.  
  5. // ----------------------------------------------------------------------------
  6. ColorSpaces::~ColorSpaces(void)
  7. {
  8. }
  9.  
  10. char* ColorSpaces::calculateLab(MSImage* image)
  11. {
  12. //    cout << image->data3D << endl;
  13. }
  14.  
  15. char* ColorSpaces::calculateLuv(MSImage* image)
  16. {
  17.  
  18. }
  19.  
  20. char* ColorSpaces::calculateRG(MSImage* image)
  21. {
  22.  
  23. }
I'm calling calculateLab from main:
Expand|Select|Wrap|Line Numbers
  1. MSImage msimage(str,false); // reads image and safes it in unsigned char*** data3D
  2. ColorSpaces::calculateLab(&msimage);

Problem 1:

Why I get this error message?
Expand|Select|Wrap|Line Numbers
  1. error LNK2001: unresolved external symbol "public: static char * __cdecl ColorSpaces::calculateLab(class MSImage *)" (?calculateLab@ColorSpaces@@SAPADPAVMSImage@@@Z)
Problem 2:
When I'm hoovering over calculateLab with my mouse, tooltip says:
Expand|Select|Wrap|Line Numbers
  1. int* ColorSpaces::calculateLab(void);
Why is that?

msdn says the following:
Only global functions and variables are placed in the OBJ PST table. Trying to access variables of the types below will often cause Unresolved Externals.
Static functions/variables

Functions declared with the static modifier by definition have file scope. Static variables have the same limitation. Trying to access any static variables from outside of the file in which they are declared can result in a compile error or an unresolved external depending on the specific coding of the source files.
But there is no solution to this problem, because my function has to be static.

Can anybody help me pleeze? Would be much appreciated. Thx

Bye
Adamn
Sep 13 '07 #1
0 1204

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: bvermeersch | last post by:
Hello, I found this in some else's code: .... void write_E2(unsigned int address, unsigned char data) { EEADR = address; EEADRH = (address >> 8); //The EEADRH:EEADR register pair is used to...
4
by: C. J. Clegg | last post by:
A month or so ago I read a discussion about putting const ints in header files, and how one shouldn't put things in header files that allocate memory, etc. because they will generate multiple...
4
by: cdrom205 | last post by:
static void MDString ( unsigned char *input) { MD5_CTX context; unsigned char digest; unsigned int len = sizeof(input);//strlen (const char*) md5.MD5Init (&context); md5.MD5Update...
7
by: Felix85 | last post by:
I am trying to make a command interpreter for a mud that i am working on the problem i am having right now is that i cannot convert the string into a char array. This is the error I am getting...
6
by: Gary Wessle | last post by:
Hi in the gsl, I am trying to use a function but getting this error **************************************************************** read_data.o: In function `read_data::matrix_the_file()':...
34
by: yaniv.dg | last post by:
hi all, i building an equition with float type now,what function should i use in order to identify is someone enter a char value by mistake?
18
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
12
by: Frodo Baggins | last post by:
Hi I need to know the size of the memory block pointed to by a char* in a function receiving this pointer. Typically, this pointer points to a string. strlen() will not do the job since sometimes...
16
by: s0suk3 | last post by:
This code #include <stdio.h> int main(void) { int hello = {'h', 'e', 'l', 'l', 'o'}; char *p = (void *) hello; for (size_t i = 0; i < sizeof(hello); ++i) {
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.