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 174017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:26:46+00:00 2026-05-11T13:26:46+00:00

I have a C++/CLI class library project in VS2005 that i am having some

  • 0

I have a C++/CLI class library project in VS2005 that i am having some problems with. I have defined a class called Languages which is a an enum class. which looks like this:

'Language.cpp' namespace Company {     namespace product     {         public eunm class Languages : int         {             English = 1,             German = 2,             //etc for other languages         };     } }; 

I then have another class that tries to references this which lives in the same namespace:

'Language.cpp' namespace Company {     namespace product     {         public class LanguageConsumer         {         public:             LanguageConsumer()             {             }         public:             Languages DoSomething(Languages input)         {             if (input == Languages::English)             {                 //Do something and return             }         };     } }; 

However my project doensn’t compile. From what i can figure out the different classes can’t see each other even thought they are in the same namespace. I assume that i might need to have header files and #includes for the header files but i just don’t know enough about C++/CLI to be sure (i come from C# background with hardly any C experience) and i have tried as many different combinations as i can think of. I’m sure i’m missing something very obvious to anybody who knows what they are doing, but alas i do not.

Thanks in advance.

  • 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. 2026-05-11T13:26:47+00:00Added an answer on May 11, 2026 at 1:26 pm

    C++/CLI still compiles like C++, file files are compiled separately and then linked together. This is different from C# which compiles all the files together. At compile time the files don’t know about each other so the code doesn’t compile (what is this enum?!). You need to have the enum definition in the same file (compilation unit) as the class.

    The simple way to do this is to move the code into the same file. The header file solution is to move the enum definition into a header file and then include it (#include) in the other file. #include inserts the text of another file, giving the same effect.

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

Sidebar

Related Questions

I have a small to medium project that is in C++/CLI. I really hate
I have an assembly, written in C++\CLI, which uses some of enumerations, provided by
I have a C# class library that contains methods that need to be used
I have different interfaces defined in a seperate class library (assembly) and they need
We have a C++/CLI class, let us call it class A, from which we
I have several independent executable Perl, PHP CLI scripts and C++ programs for which
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a script that appends some rows to a table. One of the
i have a input tag which is non editable, but some times i need
I have CLI/MFC application and I would like to begin to learn how to

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.