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-(
...
User Profile
Collapse
-
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? -
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... -
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") ;
... -
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"...Leave a comment:
-
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...
No activity results to display
Show More
Leave a comment: