Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error defining a structure

Error defining a structure

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiogame-devhelptutorial
12 Posts 7 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T RATHA KRISHNAN
    wrote on last edited by
    #1

    Hi! I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error: IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109 I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?

    C M D P 4 Replies Last reply
    0
    • T T RATHA KRISHNAN

      Hi! I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error: IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109 I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Hoe did you declare the structure ? Show some code please.

      Cédric Moonen Software developer
      Charting control [v3.0] OpenGL game tutorial in C++

      T 1 Reply Last reply
      0
      • C Cedric Moonen

        Hoe did you declare the structure ? Show some code please.

        Cédric Moonen Software developer
        Charting control [v3.0] OpenGL game tutorial in C++

        T Offline
        T Offline
        T RATHA KRISHNAN
        wrote on last edited by
        #3

        struct CameraType
        {
        core::vector3df FRONTCAM;
        core::vector3df BEHINDCAM;
        core::vector3df TOPCAM;
        };

        V 1 Reply Last reply
        0
        • T T RATHA KRISHNAN

          Hi! I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error: IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109 I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          did you include gamemanager.h ?

          #include "GameManager.h"

          Watched code never compiles.

          T 1 Reply Last reply
          0
          • M Maximilien

            did you include gamemanager.h ?

            #include "GameManager.h"

            Watched code never compiles.

            T Offline
            T Offline
            T RATHA KRISHNAN
            wrote on last edited by
            #5

            I've already included. The proble is solved by declaring the structure as const. Is it a good approach?

            S M 2 Replies Last reply
            0
            • T T RATHA KRISHNAN

              I've already included. The proble is solved by declaring the structure as const. Is it a good approach?

              S Offline
              S Offline
              Sauro Viti
              wrote on last edited by
              #6

              Declaring something as const mean that you will not need to modify it later. It's very strange that changing your declaration to const fixed the problem, anyway I think that it's a bad approach. Can you post a code snippet of your declaration?

              T 1 Reply Last reply
              0
              • T T RATHA KRISHNAN

                I've already included. The proble is solved by declaring the structure as const. Is it a good approach?

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                declaring as const should not generate the compilation error you had.

                Watched code never compiles.

                1 Reply Last reply
                0
                • S Sauro Viti

                  Declaring something as const mean that you will not need to modify it later. It's very strange that changing your declaration to const fixed the problem, anyway I think that it's a bad approach. Can you post a code snippet of your declaration?

                  T Offline
                  T Offline
                  T RATHA KRISHNAN
                  wrote on last edited by
                  #8

                  Sauro Viti wrote:

                  Can you post a code snippet of your declaration?

                  const struct CameraType { core::vector3df FRONTCAM; core::vector3df BEHINDCAM; core::vector3df TOPCAM; };

                  S 1 Reply Last reply
                  0
                  • T T RATHA KRISHNAN

                    Hi! I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error: IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109 I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    T.RATHA KRISHNAN wrote:

                    How to overcome this error?

                    See if these help: http://connect.microsoft.com/VisualStudio/feedback/details/534892/vs-2010-rc-intellisense-c-incorrectly-reports-undefined-identifier[^] http://connect.microsoft.com/VisualStudio/feedback/details/551093/intellisense-is-unable-to-locate-header-files-in-different-directory[^] http://stackoverflow.com/questions/1868603/c-error-c2065-cout-undeclared-identifier[^]

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    1 Reply Last reply
                    0
                    • T T RATHA KRISHNAN

                      Sauro Viti wrote:

                      Can you post a code snippet of your declaration?

                      const struct CameraType { core::vector3df FRONTCAM; core::vector3df BEHINDCAM; core::vector3df TOPCAM; };

                      S Offline
                      S Offline
                      Sauro Viti
                      wrote on last edited by
                      #10

                      A misunderstanding: I meant the line of code on the .cpp file that gave you the error

                      1 Reply Last reply
                      0
                      • T T RATHA KRISHNAN

                        struct CameraType
                        {
                        core::vector3df FRONTCAM;
                        core::vector3df BEHINDCAM;
                        core::vector3df TOPCAM;
                        };

                        V Offline
                        V Offline
                        vinoth8187
                        wrote on last edited by
                        #11

                        what camera model boss :laugh: .. Try Sony CameraType its 14 megaPixel really its gud :zzz: no Error will come ;P .. Thanks :cool:..Please Try after using this.. :^) :thumbsup:

                        1 Reply Last reply
                        0
                        • T T RATHA KRISHNAN

                          Hi! I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error: IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109 I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?

                          P Offline
                          P Offline
                          PSVN Roy
                          wrote on last edited by
                          #12

                          Please check all the spellings you have defined and used once ... This works some times for me.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups