Results 1 to 3 of 3

Thread: is not a type<><> error

  1. #1
    Join Date
    May 2012
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default is not a type<><> error

    hi all. im trying to create a C++ library but i faced with this error " error: 'number1' is not a type"...
    here is my code, what should i do ??
    many thanks



    # arthemticopration.pro
    #-------------------------------------------------
    #
    # Project created by QtCreator 2012-08-22T12:05:19
    #
    #-------------------------------------------------

    QT -= gui

    TARGET = ArthemticOpration
    TEMPLATE = lib

    DEFINES += ARTHEMTICOPRATION_LIBRARY

    SOURCES += arthemticopration.cpp

    HEADERS += arthemticopration.h\
    ArthemticOpration_global.h

    symbian {
    MMP_RULES += EXPORTUNFROZEN
    TARGET.UID3 = 0xE0E61B47
    TARGET.CAPABILITY =
    TARGET.EPOCALLOWDLLDATA = 1
    addFiles.sources = ArthemticOpration.dll
    addFiles.path = !:/sys/bin
    DEPLOYMENT += addFiles
    }

    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    __________________________________________________


    // arthemticopration.cpp

    #include "arthemticopration.h"
    ArthemticOpration::ArthemticOpration()
    {

    }

    int ArthemticOpration::add(number1, number2)
    {
    return number1+number2;
    }
    __________________________________________________ _


    // arthemticopration.h


    #ifndef ARTHEMTICOPRATION_H
    #define ARTHEMTICOPRATION_H

    #include "ArthemticOpration_global.h"

    //ARTHEMTICOPRATIONSHARED_EXPORT void foo();


    class ARTHEMTICOPRATIONSHARED_EXPORT ArthemticOpration {
    public:
    ArthemticOpration();

    private:
    ARTHEMTICOPRATIONSHARED_EXPORT int number1;
    ARTHEMTICOPRATIONSHARED_EXPORT int number2;
    ARTHEMTICOPRATIONSHARED_EXPORT int add(ARTHEMTICOPRATIONSHARED_EXPORT number1,ARTHEMTICOPRATIONSHARED_EXPORT number2);
    };

    #endif // ARTHEMTICOPRATION_H
    __________________________________________________ ________________________

    // ArthemticOpration_global.h


    #ifndef ARTHEMTICOPRATION_GLOBAL_H
    #define ARTHEMTICOPRATION_GLOBAL_H

    #include <QtCore/qglobal.h>

    #if defined(ARTHEMTICOPRATION_LIBRARY)
    # define ARTHEMTICOPRATIONSHARED_EXPORT Q_DECL_EXPORT
    #else
    # define ARTHEMTICOPRATIONSHARED_EXPORT Q_DECL_IMPORT
    #endif

    #endif // ARTHEMTICOPRATION_GLOBAL_H

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: is not a type<><> error

    The argument list in the declaration and definition of the add() method does not follow the syntax of C++. This is basic C++, by the way, and has nothing to do with Qt.

  3. #3
    Join Date
    Nov 2009
    Posts
    129
    Thanks
    4
    Thanked 29 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: is not a type<><> error

    Quote Originally Posted by k.qasempour View Post
    hi all. im trying to create a C++ library but i faced with this error " error: 'number1' is not a type"...
    here is my code, what should i do ??
    Set up and debug your code as an ordinary subroutine first, before you try to make a library of it.

    Seriously, I’m not being facetious... you’re way ahead of yourself. Write a simple main routine to call your functions, and write your header(s) and implementation file(s) as part of the same project. Get that to compile and run correctly before you try to figure out how to package it into a library.

    You have some “beginner” errors there, and there’s just way too much extraneous stuff (ARTHEMTICOPRATIONSHARED_EXPORT everywhere, whether it belongs or not) going on for a beginner.

Similar Threads

  1. Replies: 1
    Last Post: 21st July 2012, 21:36
  2. error: ‘QWSLinuxInputKeyboardHandler’ does not name a type
    By sanjeet in forum Installation and Deployment
    Replies: 0
    Last Post: 13th April 2012, 05:31
  3. XMLHttp type not available error occurs
    By sanket.mehta in forum Qt Quick
    Replies: 0
    Last Post: 22nd December 2011, 06:12
  4. 'Class' does not name a type error
    By naturalpsychic in forum Qt Programming
    Replies: 9
    Last Post: 1st February 2011, 15:43
  5. Data type error
    By MrShahi in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2008, 14:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.