473,729 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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 "ListaSamochodo w.h"

using namespace std;

int main(int argc, char *argv[])
{
ListaSamochodow ::wyswietl_list e_S();
cout << "Lista Samochodow to: \n";
cout << ListaSamochodow ::lista_samocho dow.nazwa << "\n";
Samochod::wypoz ycz_S();
system("PAUSE") ;
return EXIT_SUCCESS;
}

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

using namespace std;

Samochod::Samoc hod()
{
}
Samochod::~Samo chod()
{
}

void Samochod::wypoz ycz_S()
{
cout << "lista samochodow to " <<
ListaSamochodow ::lista_samocho dow.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 "ListaSamochodo w.h"
#include "Samochod.h "

ListaSamochodow ::ListaSamochod ow()
{
}
ListaSamochodow ::~ListaSamocho dow()
{
}

void ListaSamochodow ::wyswietl_list e_S()
{
ListaSamochodow ::lista_samocho dow.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 ();
~ListaSamochodo w();
static void wyswietl_liste_ S();
static Samochod lista_samochodo w;
};

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

Uzywam kompilatora Dev-C++ w wersji 4.9.9.2
Ten maly projek powinien wyswietlac zmienna skladowa "nazwa" obieku
"lista_samochod ow"
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 7567
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
`ListaSamochodo w::lista_samoch odow'
Above is a code..
The program should write on screen (windows console) value of member
variable - object lista_samochodo w.
--------------------------------------------------------------------------------------------------------------------------
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
7786
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~ make.exe -f "D:\temp\Makefile.win" all g++.exe -c main.cpp -o
12
801
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 Guide" Using Dev-C++ 4.9.9.2, The error is: undefined reference to ‘f(int)’ all the following files are in the same dir. thanks
2
9401
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> client.cpp & client.hpp - define the class client derived from tree main.cpp - the main function instantiate client and run All these files are compiled successfully, but there's a linker error " undefined reference to `base<int>::base_run()' ". ...
5
2663
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 std;
1
1954
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 macro. There is another separate .cpp file that actually defines the function. I assumed that if I had these three separate source files saved in the same directory (C:\) that my compilier would find the header file along with the other .cpp file and...
3
11597
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 -DTRACING - D__EXTENSIONS__ -D__RWCOMPILER_H__ -D_REENTRANT -D_RWCONFIG=8s - D_RWCONFIG_12d -D_RWSTDDEBUG -DRWDEBUG -o test1 test1.o -L/lib -
6
3530
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 { public: FrameBuffer(int prmWidth, int prmHeight, unsigned long prmPen); FrameBuffer(int prmWidth, int prmHeight);
3
3595
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
4
19737
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 (C:\\ folder) 3. happy coding I can understand the frustration, as i had with this error.
0
9280
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.