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

LNK2001 About Aws::Http::CONTENT_TYPE_HEADER and Aws::Http::CONTENT TYPE HEADER #3209

Closed
1 task
guoyuanchao94 opened this issue Nov 28, 2024 · 5 comments
Closed
1 task
Labels
bug This issue is a bug. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@guoyuanchao94
Copy link

guoyuanchao94 commented Nov 28, 2024

Describe the bug

  • When I used the built library file, using the official example, there were two link errors

  • Severity Code Description Item File line Does not display status details Error LNK2001 cannot resolve external symbols "char const * const Aws::Http::CONTENT TYPE HEADER" (? CONTENT TYPE HEADER@Http@Aws@@3QBDB) AWSTest D:\C++\AWSTest\main.obj 1

  • Severity Code Description Item File line Prohibited from displaying status details Error LNK2001 failed to parse external symbols "char const * const Aws::Http::API VERSION HEADER" (? API VERSION HEADER@Http@Aws@@3QBDB) AWSTest D:\C++\AWSTest\main.obj 1

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

No Error

Current Behavior

Error LNK2001 External symbols that cannot be resolved "char const * const Aws::Http::CONTENT_TYPE_HEADER" (?CONTENT_TYPE_HEADER@Http@Aws@@3QBDB) AWSTest D:\C++\AWSTest\main.obj 1

Error LNK2001 External symbols that cannot be resolved "char const * const Aws::Http::API_VERSION_HEADER" (?API_VERSION_HEADER@Http@Aws@@3QBDB) AWSTest D:\C++\AWSTest\main.obj 1

Reproduction Steps

#include <aws/core/Aws.h>
#include <aws/autoscaling/AutoScalingClient.h>
#include <aws/autoscaling/model/DescribeAutoScalingGroupsRequest.h>
#include <iostream>

/*
 *  A "Hello Autoscaling" starter application which initializes an Amazon EC2 Auto Scaling client and describes the
 *  Amazon EC2 Auto Scaling groups.
 *
 *  main function
 *
 *  Usage: 'hello_autoscaling'
 *
 */

int main(int argc, char** argv) 
{
    Aws::SDKOptions options;
    // Optionally change the log level for debugging.
   options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug;
    Aws::InitAPI(options); // Should only be called once.
    int result = 0;
    {
        Aws::Client::ClientConfiguration clientConfig;
         //Optional: Set to the AWS Region (overrides config file).
         clientConfig.region = "us-east-1";

        Aws::AutoScaling::AutoScalingClient autoscalingClient(clientConfig);

        std::vector<Aws::String> groupNames;
        Aws::String nextToken; // Used for pagination.

        do {

            Aws::AutoScaling::Model::DescribeAutoScalingGroupsRequest request;
            if (!nextToken.empty()) 
            {
                request.SetNextToken(nextToken);
            }

            Aws::AutoScaling::Model::DescribeAutoScalingGroupsOutcome outcome =
                autoscalingClient.DescribeAutoScalingGroups(request);

            if (outcome.IsSuccess()) 
            {
                const Aws::Vector<Aws::AutoScaling::Model::AutoScalingGroup>& autoScalingGroups =
                    outcome.GetResult().GetAutoScalingGroups();
                for (auto& group : autoScalingGroups) {
                    groupNames.push_back(group.GetAutoScalingGroupName());
                }
                nextToken = outcome.GetResult().GetNextToken();
            }
            else 
            {
                std::cerr << "Error with AutoScaling::DescribeAutoScalingGroups. "
                    << outcome.GetError().GetMessage()
                    << std::endl;
                result = 1;
                break;
            }
        } while (!nextToken.empty());

        std::cout << "Found " << groupNames.size() << " AutoScaling groups." << std::endl;
        for (auto& groupName : groupNames) 
        {
            std::cout << "AutoScaling group: " << groupName << std::endl;
        }

    }
    Aws::ShutdownAPI(options); // Should only be called once.
    //return result;
}

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.455

Compiler and Version used

Visual Studio

Operating System and version

Windows 11 22631.4460

@guoyuanchao94 guoyuanchao94 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 28, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@guoyuanchao94 guoyuanchao94 reopened this Nov 28, 2024
@guoyuanchao94 guoyuanchao94 changed the title LNK2001 External symbols that cannot be resolved "char const * const Aws::Http::CONTENT_TYPE_HEADER" (?CONTENT_TYPE_HEADER@Http@Aws@@3QBDB) LNK2001 About Aws::Http::CONTENT_TYPE_HEADER and Aws::Http::CONTENT TYPE HEADER Nov 28, 2024
@guoyuanchao94
Copy link
Author

guoyuanchao94 commented Nov 28, 2024

image
i add macro this before all include, and it slove this problem

@jmklix
Copy link
Member

jmklix commented Dec 2, 2024

Are you still running into the above errors?

It looks like you temporarily closed this issue and also provided an answer. Please let us know if you need any help with using this sdk.

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Dec 2, 2024
@guoyuanchao94
Copy link
Author

@jmklix Now I have solved this problem by #define USE_IMPORT_EXPORT in front of all header files. I don't need any help at the moment, thank you for your reply. if i need help,i will create issue again;

@jmklix jmklix closed this as completed Dec 3, 2024
Copy link

github-actions bot commented Dec 3, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

2 participants