Skip to content

unresolved external symbol CONTENT_TYPE_HEADER and API_VERSION_HEADER #1235

@ludekvodicka

Description

@ludekvodicka

What platform/OS are you using?

Windows10,

Which version of the SDK?

1,7,182

What compiler are you using? what version?

Visual Studio 2019 16.2.4

What are your CMake arguments?

cmake .. -G "Visual Studio 16" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=q:\SharedLibraries\aws32 -DBUILD_ONLY="email " -DENABLE_TESTING="OFF"

Can you provide a TRACE level log? (sanitize any sensitive information)

1>aws.test.cpp
1>aws.test.obj : error LNK2001: unresolved external symbol "char const * const Aws::Http::CONTENT_TYPE_HEADER" (?CONTENT_TYPE_HEADER@Http@Aws@@3PBDB)
1>aws.test.obj : error LNK2001: unresolved external symbol "char const * const Aws::Http::API_VERSION_HEADER" (?API_VERSION_HEADER@Http@Aws@@3PBDB)
1>..\GeneratedFiles\Debug32\\AtomixDevelopment.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "AtomixDevelopment.vcxproj" -- FAILED.

I'm testing AWS SDK but I'm not able to find out why these two symbols are missing.

  • My project correctly including aws-cpp-sdk-core.lib and aws-cpp-sdk-email.lib
  • There is no problem with another exported classes from these libraries.
  • AWS SDK is generated through cmake and has defined USE_WINDOWS_DLL_SEMANTICS and USE_IMPORT_EXPORT (I tried USE_IMPORT_EXPORT as same as USE_IMPORT_EXPORT=1)
  • It seems that AWS_CORE_API is correctly configured as #define AWS_CORE_API __declspec(dllexport)

Minimal test case:

#include <aws/core/Aws.h>
#include <aws/email/SESClient.h>
#include <aws/email/model/SendEmailRequest.h>
#include <aws/email/model/SendEmailResult.h>
#include <aws/email/model/Destination.h>
#include <aws/email/model/Message.h>
#include <aws/email/model/Body.h>
#include <aws/email/model/Content.h>
#pragma comment(lib, "q:\\SharedLibraries2019\\aws32\\bin\\aws-cpp-sdk-core.lib")
#pragma comment(lib, "q:\\SharedLibraries2019\\aws32\\bin\\aws-cpp-sdk-email.lib")

void test()
{
	Aws::SDKOptions options;
	Aws::InitAPI(options);
	{
		Aws::String message_body_html_data("html email");
		Aws::String message_body_text_data("text email");
		Aws::String message_subject_data("Migration to amazon");
		Aws::String sender_email_address("ludek.vodicka@gmail.com");
		Aws::String cc_address("ludek.vodicka@gmail.com");
		Aws::String reply_to_address("ludek.vodicka@gmail.com");
		Aws::SES::SESClient ses;

		Aws::SES::Model::SendEmailRequest se_req;
	}
	Aws::ShutdownAPI(options);
}

Thanks for any hint.

Edit1:

I just also tried to update

extern AWS_CORE_API const char* API_VERSION_HEADER;
to
extern __declspec(dllexport) const char* API_VERSION_HEADER;

but still with the same result.

Activity

ludekvodicka

ludekvodicka commented on Sep 13, 2019

@ludekvodicka
Author

Just solved it.

It's necessary to define #define USE_IMPORT_EXPORT before any include also in the application.

#define USE_IMPORT_EXPORT
#include <aws/core/Aws.h>
#include <aws/email/SESClient.h>
#include <aws/email/model/SendEmailRequest.h>
#include <aws/email/model/SendEmailResult.h>
#include <aws/email/model/Destination.h>
#include <aws/email/model/Message.h>
#include <aws/email/model/Body.h>
#include <aws/email/model/Content.h>

After that, AWS_CORE_API is correctly defined in Core_EXPORTS.h as _declspec(dllimport)

Not sure why this is necessary and why this is not mentioned in the documentation.

singku

singku commented on Sep 13, 2019

@singku
Contributor
ludekvodicka

ludekvodicka commented on Sep 13, 2019

@ludekvodicka
Author

You're right. I already found it also here https://github.com/aws/aws-sdk-cpp in "Using the SDK".

Thanks for the response.

guoyuanchao94

guoyuanchao94 commented on Nov 28, 2024

@guoyuanchao94

Hello, after five years,i miss this issue,and you help me slove this problem,thank you so much😘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @singku@ludekvodicka@guoyuanchao94

        Issue actions

          unresolved external symbol CONTENT_TYPE_HEADER and API_VERSION_HEADER · Issue #1235 · aws/aws-sdk-cpp