×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Metrowerks CW - Create New .cpp File?

    Hi all

    I have created a new project using the wizard. I selected S60 App.
    Now I would like to create and add a new file. I tried File->New... and selected the File tab but the only choice provided is a text file. I would like to create a .cpp file.
    Can anyone help me?

    Thank you,
    Gloria

  2. #2
    Regular Contributor
    Join Date
    May 2004
    Posts
    462

    Re: Metrowerks CW - Create New .cpp File?

    Why not try to create the file manually, then add the cpp file name in the mmp file, and re-import the project from mmp file.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Re: Metrowerks CW - Create New .cpp File?

    I have tried to do this but then Metrowerks says it cannot open the .h file.
    I created two empty files, put some code in them and renamed them (in Windows Explorer) to myFile.cpp and myFile.h and also added the .cpp to the .mmp.
    Have you done this and it worked? That is: can you add your own new classes to your project?


    Gloria

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,335

    Smile Re: Metrowerks CW - Create New .cpp File?

    Hello Gloria,

    For additional files,
    What i do with VS6 , VS 2003 +Carbide.Vs: i put .h file in inc folder and .cpp file in src folder, under project's folder.
    By putting .h file in project's inc folder, it will be refered by USERINCLUDE path in .mmp, automatically.
    You need to have entry for .cpp file in .mmp under SOURCE category.

    Whenever you modify entries in .mmp file, you have to rebuild your project.

    Regards.
    Kiran.

  5. #5
    Regular Contributor
    Join Date
    May 2004
    Posts
    462

    Re: Metrowerks CW - Create New .cpp File?

    The previous reply is very details, is your header file in inc folder?

  6. #6
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Re: Metrowerks CW - Create New .cpp File?

    Dear Kiran, dear Skygyl

    Yes, this is what I did and I cannot compile anymore even though the header file is in the inc directory.
    Still "the file myFile.h cannot be opened"

  7. #7
    Regular Contributor
    Join Date
    May 2004
    Posts
    462

    Re: Metrowerks CW - Create New .cpp File?

    That is strange. I have tens of files created in such a way. Maybe you can post your dummy h and cpp file here.

  8. #8
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Re: Metrowerks CW - Create New .cpp File?

    Hi Skygyl


    Here are the files:

    TestIntervalGenerator.h looks like this:

    class TestIntervalGenerator
    {

    public:

    int GenerateInterval();

    }



    And TestIntervalGenerator.cpp like this:

    int
    TestIntervalGenerator::GenerateInterval(){
    return 2;
    }


    Thank you for your help,

    Gloria

  9. #9
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,335

    Smile Re: Metrowerks CW - Create New .cpp File?

    Hello Gloria,

    Put ; at the end of .h file.
    like:
    class TestIntervalGenerator
    {

    public:

    int GenerateInterval();

    }; // Here
    Regards.
    Kiran.

  10. #10
    Regular Contributor
    Join Date
    May 2004
    Posts
    462

    Re: Metrowerks CW - Create New .cpp File?

    Try this: add test.cpp into your mmp file, and re-import your project
    Code:
    // Test.h in inc folder
    #ifndef __TEST_H__
    #define __TEST_H__
    class CTest: public CBase
    {
    public: 
    CTest();
    ~CTest();
    };
    #endif
    
    // Test.cpp in src folder
    #include "Test.h"
    CTest::CTest()
    {
    }
    CTest::~CTest()
    {
    }

  11. #11
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Re: Metrowerks CW - Create New .cpp File?

    Dear Kiran

    I have tried the ; at the end of the header file but still get the same error.

    Dear Sygyl

    In my project there is alredy a file called test.cpp because I called the project test.
    But I have tried what you said with replacing every "Test" with "IntervalGenerator" but it still says it cannot open the header file :,(


    Gloria

  12. #12
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Metrowerks CW - Create New .cpp File?

    Quote Originally Posted by glmuelle
    Hi all

    I have created a new project using the wizard. I selected S60 App.
    Now I would like to create and add a new file. I tried File->New... and selected the File tab but the only choice provided is a text file. I would like to create a .cpp file.
    Can anyone help me?

    Thank you,
    Gloria
    A .cpp file is a text file, (compared to a binary file, or new project).

    Simply create the new file name it with .cpp extension and save it. I think they are added automatically to the project if not do add file from project menu.

    Ron

  13. #13
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Metrowerks CW - Create New .cpp File?

    Quote Originally Posted by glmuelle
    Dear Kiran, dear Skygyl

    Yes, this is what I did and I cannot compile anymore even though the header file is in the inc directory.
    Still "the file myFile.h cannot be opened"
    There are reasons it can not be found. First is usually the file is not in a path. Remember <> are system included paths and "" are project included paths make sure the path for your header file is in the Project included path and not system.

    The second problem is spelling, adding a leading or trailing space is quite common problem especially if you don't use a monotype font (courier). Case should not matter but it may, so don't have MyFile in the file name and "myFile" in the source include.

    Ron

  14. #14
    Registered User
    Join Date
    Jan 2006
    Location
    Zurich, Switzerland
    Posts
    28

    Smile Re: Metrowerks CW - Create New .cpp File?

    Hi Ron


    HURRAY!!!! :) :) It compiles again! Thank you so much!!
    I have now created the files naming them .cpp and .h using the wizard.
    I still don't know why I couldn't rename the text file to .cpp though... Do you have any idea why? Now the files have just the same names and the same code as before but before the compiler couldn't open the header file...


    Kind regards,

    Gloria

  15. #15
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Metrowerks CW - Create New .cpp File?

    I don't know why it wouldn't let you change a name unless you had the file open at the time. It won't let you change the name of an open file.
    by the way there are two ways to save As and Save a Copy as, SaveAs replaces the current project, Save a copy As will make a copy. Both retain the original file, it just depends if you want the copy in your project or as a back up.

    Ron

Page 1 of 2 12 LastLast

Similar Threads

  1. How to create a Text file in Nokia 6630?
    By rajneesh103 in forum Mobile Java General
    Replies: 3
    Last Post: 2006-10-28, 19:40
  2. S60 theme questions
    By Nokian_Spb in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-17, 06:11
  3. Urgent plz help:how to create convert java file to jad file
    By jacho80 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2006-08-07, 10:50
  4. Series 60 SDK Appwizard on windows xp
    By moonjoor in forum Symbian Tools & SDKs
    Replies: 15
    Last Post: 2003-12-24, 10:22
  5. How can I create a mms file with Chinese GB subject
    By guof in forum General Messaging
    Replies: 1
    Last Post: 2003-05-21, 03:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •