User Profile

Collapse

Profile Sidebar

Collapse
maabar
maabar
Last Activity: Sep 3 '06, 04:02 PM
Joined: Aug 29 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • maabar
    started a topic Linking files
    in C

    Linking files

    Hi,
    I am trying to compile and link two files using g++

    Here is what I have:

    FileHandler.h
    FileHandler.cpp
    FileTest.cpp

    FileTest.cpp has an object of FileHandler, and it is the main program.

    I am trying the following commands:
    g++ -c FileTest.cpp
    g++ FileTest.cpp FileHandler.o
    g++ -o FileTest FileTest.cpp

    but no luck 8-(
    ...
    See more | Go to post

  • maabar
    replied to how to import classes in one class
    in C
    I am using g++ and I am using the following compiling commands:

    g++ -Wall -Lpath MainClass MainClass.cpp -o

    where path is the location of the directory that has my files.

    I am getting the following error messages:

    "In 'main': undefined reference to 'Class1::somefu nctions()':coll ect2:ld returened 1 exit status"

    Any suggestions?
    See more | Go to post

    Leave a comment:


  • maabar
    started a topic how to import classes in one class
    in C

    how to import classes in one class

    Hi,
    can anybody tell me the codes to import more than one class, i.e. (.cpp) file, into another class?

    For example, if I have the following classes:
    "class1.cpp "
    "class2.cpp "

    and I want to declare objects of these classes in my main class: "MainClass. cpp"

    Do I need to declare header files for class1 and class2?

    Also, what would be the compiling...
    See more | Go to post

  • maabar
    started a topic Conversion of char to a string
    in C

    Conversion of char to a string

    Hi, I need to know how could I use the class ifstream if I want to pass a string to its constructor?

    For example, if I have the following codes:

    string name = "file.txt";

    ifstream f(name);

    the compiler says that ifstream doesn't take string as an argument, so what do I need to do to use the above codes? I don't want to use ifstream f("file.txt") ;

    ...
    See more | Go to post

  • maabar
    replied to I am a C++ beginner
    in C
    Ok, here are the files:

    MyHeader.h:

    #ifndef _HEADERF_H
    #define _HEADERF_H


    #include <iostream>
    #include <string>

    using namespace std;

    class MyClass

    {

    public:

    void SomeFunction();

    int SomeNumber;

    };

    #endif

    The "MyClass.cp p"...
    See more | Go to post

    Leave a comment:


  • maabar
    started a topic I am a C++ beginner
    in C

    I am a C++ beginner

    Hi,
    Can you please help with this..
    I need to develop a program that involves two classes: FileHandling and DataProcessing.
    I have developed header files and implementation for both classes i.e. *.h and *.cpp
    Now, in my main program I have created an object of each class and I want to use these objects to access the functions of these classes.

    so my codes look something like this:

    #includ...
    See more | Go to post
No activity results to display
Show More
Working...