Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8523871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:32:00+00:00 2026-06-11T07:32:00+00:00

In a *.cpp file, trying to use a third party lib: #define DLL_IMPORT #include

  • 0

In a *.cpp file, trying to use a third party lib:

#define DLL_IMPORT 
#include <thirdParty.h>
// Third party header has code like:
// #ifdef DLL_IMPORT
//    #define DLL_DECL __declspec(dllimport)

// fatal error C1001: An internal error has occurred in the compiler.

Alternative:

#define NO_DLL
#include <thirdParty.h>
// Third party header has code like:
// #elif defined(NO_DLL)
//    #define DLL_DECL


// Compiles fine, but linker errors as can't find DLL functions

I can reproduce results by remove macros and #define all together and manually editing the third party files to have __declspec(dllimport) or not – so the preprocessor stuff above is just to show what’s going on, it’s not copy-paste.

Has anyone come across anything similar, or can hint at the cause? (which is created using CMake). Above is actual example of 2 line *.cpp that crashes so it’s narrowed down to something in the #include.

The following also work fine:

  1. Compile the examples provided by the third party (they provide a *.sln) that use dllimport/export so it doesn’t appear to be the fault of the library
  2. Compile the third party lib as part of the production project (so dllexport works fine)

I’ve trawled the project settings pages of the two projects to try and spot differences, but have come up blank. Of course, it’s possible I’m missing something as those settings pages are not the easiest to navigate. I’ll get access to VS2008 in a day or so, so can compare with that. The third party library is MySql++.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:32:01+00:00Added an answer on June 11, 2026 at 7:32 am

    A compiler crash is definitely a bug in the compiler, so you’re best off submitting an error report to the Microsoft Visual C++ team.

    As for the error

    #define DLL_DECL __declspec(dllimport)
    

    is the wrong way to go about things. There should be some project setting you need to set, a pre-processing directive you can define instead if DLL_DECL, or simply including a different file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Should I #include everything I need in every header/cpp file? I am working on
I'm trying to include a header file in a resource file (.rc). The path
I'm trying to build the following block of code in a 1-file .cpp file:
I am trying to use the \listing package to include some .cpp files into
I am trying to display the contents of a .cpp file in php. I
I have the following code in one cpp file which is part of a
header file: private: vector<int*>* nums; public slots: void buttonClicked(); cpp file: NewWindow(){ int one
I have three files, a main .cpp file: #include <stdio.h> #include myClass.h int main()
SVector.H: void pop_back() throw (underflow_error); In my SVector.cpp file, should I also include the
I'm trying to compile an executable (ELF file) that does not use a dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.