Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS2022 stbir_resize_uint8 ERROR #1644

Open
recondra opened this issue May 20, 2024 · 1 comment
Open

VS2022 stbir_resize_uint8 ERROR #1644

recondra opened this issue May 20, 2024 · 1 comment

Comments

@recondra
Copy link

VS2022 ::: Severity Code Description Project File Line Suppression State Details
Error LNK2001 unresolved external symbol stbir_resize_uint8 RysuneBotGUI C:\Users\User\Desktop\Quansen\RysuneBotGUI\main.obj 1

Line of Code:

int desired_width = 720;
int desired_height = 720;
void* resized_image_data_ptr = malloc(desired_width * desired_height * 4);
if (!resized_image_data_ptr) {
std::cerr << "Failed to allocate memory" << std::endl;
stbi_image_free(image_data);
return -1;
}
unsigned char* resized_image_data = static_cast<unsigned char*>(resized_image_data_ptr);

stbir_resize_uint8(image_data, width, height, 0, resized_image_data, desired_width, desired_height, 0, 4); //
The line where the error is found (It gets fixed when removed)
Ekran görüntüsü 2024-05-20 203930

@nothings
Copy link
Owner

From the documentation:

  COMPILING & LINKING
      In one C/C++ file that #includes this file, do this:
         #define STB_IMAGE_RESIZE_IMPLEMENTATION
      before the #include. That will create the implementation in that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants