Need Help in VC++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jagmeet
    New Member
    • Jan 2007
    • 4

    #1

    Need Help in VC++

    I want to use API's in VC++ ...
    Can anyone tell me how to include the files.....

    I am not getting API headers in VC++
  • LSB
    New Member
    • Jan 2007
    • 8

    #2
    Originally posted by jagmeet
    I want to use API's in VC++ ...
    Can anyone tell me how to include the files.....

    I am not getting API headers in VC++
    Can you please give us a simple sample of your attempt?
    Like "Hello, world!"?
    Along with error message(s) from compiler?

    Comment

    • jagmeet
      New Member
      • Jan 2007
      • 4

      #3
      Originally posted by LSB
      Can you please give us a simple sample of your attempt?
      Like "Hello, world!"?
      Along with error message(s) from compiler?
      Source Code:
      Code:
      #include "appapi.h"        
        /*commenting above header gives the compilation errors problem with header...  */
      
      #include "iostream"
      using namespace System;
      class MyApp
      {
      AppAPI *App;
      public:
      MyApp();
      int StartScheduler();
      static const int StartFun(void *userdata);
      };
      int main()
      {
      if (AppAPI::Init()) exit(0);
      MyApp *app = new MyApp;
      return app->StartScheduler();
      }
      MyApp::MyApp()
      {
      App = AppAPI::Create();
      if (App == NULL) exit(1);
      }
      int MyApp::StartScheduler()
      {
      return AppAPI::Start(App, &MyApp::StartFun, this);
      }
      const int MyApp::StartFun(void *userdata)
      {
      MyApp *app = (MyApp *)userdata;
      .
      .
      .
      return 0;
      }
      Here is the Compilation result

      ------ Build started: Project: as, Configuration: Debug Win32 ------
      Compiling...
      as.cpp
      .\as.cpp(6) : error C2143: syntax error : missing ';' before '*'
      .\as.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      .\as.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      .\as.cpp(14) : error C2653: 'AppAPI' : is not a class or namespace name
      .\as.cpp(14) : error C3861: 'Init': identifier not found
      .\as.cpp(20) : error C2065: 'App' : undeclared identifier
      .\as.cpp(20) : error C2653: 'AppAPI' : is not a class or namespace name
      .\as.cpp(20) : error C3861: 'Create': identifier not found
      .\as.cpp(25) : error C2653: 'AppAPI' : is not a class or namespace name
      .\as.cpp(25) : error C3861: 'Start': identifier not found
      .\as.cpp(30) : error C2143: syntax error : missing ';' before '.'
      Build log was saved at "file://c:\Documents and Settings\jagmee t\My Documents\Visua l Studio 2005\Projects\a s\as\Debug\Buil dLog.htm"
      as - 11 error(s), 0 warning(s)
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
      Last edited by Banfa; Jan 24 '07, 10:54 AM. Reason: Added [code]...[/code] round the code

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        I think the errors and answer are rather dependent on the contents of appapi.h, perhaps you could post it.


        The compilation errors are occuring because at the line in question

        AppAPI *App;

        the class AppAPI has not been defined yet.

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          Are you using the correct namespace for the AppAPI class? Does the AppAPI class exists in the default or System namespace?

          Comment

          Working...