473,388 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

[Linker error] undefined reference... pliki .h... dev-c++

s_4
Witam!
Mam maly problem... to chyba juz wszyscy wiedza... :-)
do rzeczy:

1. zrobilem maly projekt i wywala mi takie bledy jak w tytule (tylko
takie)
2. kompilujac kazdy plik z osobna nie ma bledow, ale kompilujac caly
projekt to wystepuja powyzsze bledy
3. specjanie na potrzeby tego postu mocno okroilem moj projekt i nadla
wywala ten sam blad tylko w trzech miejscach, a nie w stu piedziesieciu
pieciu, wiec chyba bedzie latwiej namierzyc blad

zamieszam kod:
--------------------------- Plik main.cpp ----------------------------
#include <iostream>
#include <cstdlib>
#include "Samochod.h"
#include "ListaSamochodow.h"

using namespace std;

int main(int argc, char *argv[])
{
ListaSamochodow::wyswietl_liste_S();
cout << "Lista Samochodow to: \n";
cout << ListaSamochodow::lista_samochodow.nazwa << "\n";
Samochod::wypozycz_S();
system("PAUSE");
return EXIT_SUCCESS;
}

---------------------------------- Plik Samochod.cpp
-------------------------------
#include <iostream>
#include <string.h>
#include "Samochod.h"
#include "ListaSamochodow.h"

using namespace std;

Samochod::Samochod()
{
}
Samochod::~Samochod()
{
}

void Samochod::wypozycz_S()
{
cout << "lista samochodow to " <<
ListaSamochodow::lista_samochodow.nazwa << "udalo sie";
}

--------------------------------- Plik Samochod.h
--------------------------------------
#ifndef SAMOCHOD_H
#define SAMOCHOD_H
#include <iostream>
#include <string.h>

class Samochod {
public:
Samochod();
~Samochod();
int cena;
string rodzaj;
string nazwa;
string stan;
static void wypozycz_S();
};

#endif //SAMOCHOD_H

------------------------ Plik ListaSamochodow.cpp
------------------------------------------
#include <iostream>
#include <string.h>
#include "ListaSamochodow.h"
#include "Samochod.h"

ListaSamochodow::ListaSamochodow()
{
}
ListaSamochodow::~ListaSamochodow()
{
}

void ListaSamochodow::wyswietl_liste_S()
{
ListaSamochodow::lista_samochodow.nazwa = "Audi";
}

------------------------- Plik ListaSamochodow.h
-----------------------------------------
#ifndef LISTASAMOCHODOW_H
#define LISTASAMOCHODOW_H
#include <iostream>
#include <string.h>
#include "Samochod.h"

class ListaSamochodow : public Samochod {
public:
ListaSamochodow();
~ListaSamochodow();
static void wyswietl_liste_S();
static Samochod lista_samochodow;
};

#endif //_LISTA SAMOCHODOW_H
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Uzywam kompilatora Dev-C++ w wersji 4.9.9.2
Ten maly projek powinien wyswietlac zmienna skladowa "nazwa" obieku
"lista_samochodow"
Klasa ListaSamochodow dziedziczy z klasy Samochod.
Co mam zrobic aby takie bledy mi nie wychodzily?
Czym to moze byc spowodowane?

Prosze Was drodzy internauci o pomoc...
Z gory dziekuje.
Marcin Bojarczuk

Dec 16 '05 #1
4 7556
s...@wp.pl wrote:
Witam!
Mam maly problem... to chyba juz wszyscy wiedza... :-)
do rzeczy:

[snip]

In English please. Most of us don't speak Polish.

Cheers! --M

Dec 16 '05 #2
s_4

Sorry I send post to wrong language group...
my English is weak... :-(

I have a problem during compilation

[Linker error] undefined reference to
`ListaSamochodow::lista_samochodow'
Above is a code..
The program should write on screen (windows console) value of member
variable - object lista_samochodow.
--------------------------------------------------------------------------------------------------------------------------
Please do not use informal language, becouse I will have problems with
undestand it.
--------------------------------------------------------------------------------------------------------------------------

Dec 16 '05 #3
s_4
I want to add that each file was copmpiled and there was no mistakes...
but if I compile all project, a compilator show me a [linker error]
undefined reference (in three places)

Dec 16 '05 #4
s_*@wp.pl wrote:
I want to add that each file was copmpiled and there was no mistakes...
but if I compile all project, a compilator show me a [linker error]
undefined reference (in three places)


Hello,

Could you show us the linker error (in english)?
Perhaps a library was not included in the correct order while linking.

Regards,
Peter Jansson
Dec 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hardy | last post by:
Hi, just come into the boost world. just the first.cpp in the program_options examples, with many link error... devc++4.9.9.2, gcc 3.4.2, can I get your opinions on this problem? thank you~ ...
12
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions...
2
by: haplotype | last post by:
I have designed a package with several files, which is listed bellow base.cpp & base.hpp - define the template class base tree.cpp & tree.hpp - define the class tree derived from base<int>...
5
by: Mark | last post by:
Sorry for creating such a newbish topic, but I just can't seem to figure out what the problem is here. // main.cpp #include <cstdlib> #include <iostream> #include "Vector.h" using namespace...
1
by: ImamicPH | last post by:
Hi, My first post. How do you resolve linker errors? I have a simple header file that contains one function declaration. This function is used in another file (.cpp) in the definition of a...
3
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE...
6
by: Ed Dana | last post by:
I'm trying to create a dynamic two dimensional array. My code looks like this: ====================================================================== #define DEF_FrameBuffer_H class FrameBuffer...
3
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
4
by: sanketiiit | last post by:
ERROR: Bloodshed Dev c++ undefined reference to cpu_features_init Perfect Solution to this error. If ( Installed MinGW ) then: 1. Uninstall MinGW 2. Delete manually MinGW Folder...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.