Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » mechatronic transmission project [was -Please, help me!]
icon3.gif  mechatronic transmission project [was -Please, help me!] [message #389] Sun, 11 December 2005 11:23 Go to next message
mechatronic is currently offline  mechatronic
Messages: 10
Registered: December 2005
Location: Viet Nam
Promising Member

Hello everybody! This is my first project using U++. I want to build a program to solve the TRANSPORT PROBLEM, it's just then beginning, but I dont understand the error description. Details are below:
Source:
Tranmission.h
#ifndef _Tranmission_Tranmission_h
#define _Tranmission_Tranmission_h

#include <CtrlLib/CtrlLib.h>
//#include <stdlib.h>
//#include <stdio.h>
//#include <string.h>

#define LAYOUTFILE <Tranmission/Tranmission.lay>
#include <CtrlCore/lay.h>

#define IMAGEFILE <Tranmission/Tranmission.iml>
#include <Draw/iml_header.h>

//float DulieuVao [101][101];

//fpos_t* pos (FILE *f);

//unsigned char parify (char c);

//int DocDulieu (char *Filename,int *m,int *n);
class AboutDlg : public WithAboutDlg<TopWindow> {

void Exit()
{
Close ();
}

public:

typedef AboutDlg CLASSNAME;
AboutDlg ();

};


class Tranmission : public WithTranmissionLayout<TopWindow> {

bool saved;
FileSel fs;
int m,n;
char *Filename;

void Exit()
{
if (saved||PromptOKCancel ("Are you sure to close program without save your work?")) Close ();
}

void New()
{
;}

void Save()
{

;}

void SaveAs()
{
;}

void Open()
{
/*fs.Type ("Tranmission Data (*.tms)","*.tms");
if (!(fs.ExecuteOpen ("Load file..."))) return;
//Filename = fs.;
char *temp;
switch (DocDulieu("J:\dulieu.tms",&m,&n)){
case 1: PromptOK ("Can not load file!");break;
case 2: PromptOK ("File structure is not valid!");break;
default:
itoa (m,temp,10);
phat = Format ("Delivery: %s",temp);
itoa (n,temp,10);
thu = Format ("Receive: %s",temp);
}
PromptOK("Load File");*/
;}

void Help()
{
;}

void About()
{
AboutDlg about;
about.Run();
}

void Menu1(Bar& bar)
{
bar.Add("&New",imgNew(), THISBACK(New))
.Key(K_CTRL_N);
bar.Add("&Open",imgOpen(), THISBACK(Open))
.Key(K_CTRL_O);
bar.Add("&Save",imgSave(), THISBACK(Save))
.Key(K_CTRL_S);
bar.Add("Save as", THISBACK(SaveAs));
bar.Separator();
bar.Add("E&xit", THISBACK(Exit))
.Key(K_CTRL_X);
}

void Menu2(Bar& bar)
{
bar.Add("Help",imgHelp(), THISBACK(Help))
.Key(K_F1);
bar.Separator();
bar.Add("About", THISBACK(About));
}

void MainMenu(Bar& bar)
{
bar.Add("File", THISBACK(Menu1));
bar.Add("Help", THISBACK(Menu2));
}

void MainToolBar(Bar& bar)
{
bar.Add(imgNew,THISBACK(New));
bar.Add(imgOpen,THISBACK(Open));
bar.Add(imgSave,THISBACK(Save));
bar.Separator();
bar.Add(imgHelp,THISBACK(Help));
}


MenuBar menu;
ToolBar toolbar;

public:

typedef Tranmission CLASSNAME;
Tranmission();

};

/*fpos_t* pos (FILE *f)
{
fpos_t *x;
fgetpos(f,x);
return x;
}

unsigned char parify (char c)
{
int flag;
switch (c){
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':flag= 1;break;
default: flag= 0;}
return flag;
}

int DocDulieu (char *Filename,int *m,int *n)
{
unsigned char err = 0;
char c, t[2];
char *h;
FILE *f;
if ( !(strcmp(Filename,"")))
{
f = fopen ( Filename,"rw");
if (f == NULL){ err = 1; goto END;} //Khong ton tai tap tin nay
{fgets(h,10,f);
if (strcmp(h,"BTVT\n")) {err = 2; goto END;} //File khong dung dinh dang hoac Du lieu trong file sai
strcpy (h,"");
do
{c = fgetc(f);
if (!((c==' ')||(c=='\n')))
{itoa(c-48,t,10);
strcat(h,t);}
}while (!(!parify(c))||feof(f));
*m = atoi(h);
if ((feof(f))||(m<=0)) {err = 2; goto END;}
strcpy (h,"");
do
{c=fgetc(f);
if (!((c==' ')||(c=='\n')))
{itoa(c-48,t,10);
strcat(h,t);}
}while (!(!parify(c))||feof(f));
*n = atoi(h);
if ((feof(f))||(n<=0)) {err = 2; goto END;}
}
}
END:
return err;
}
*/
#endif

main.cpp

#include "Tranmission.h"

//#define IMAGEFILE <Tranmission/Tranmission.iml>
//#include <Draw/iml_source.h>

Tranmission::Tranmission()
{
saved = 1;
AddFrame(menu);
menu.Set( THISBACK (MainMenu) );
AddFrame( TopSeparatorFrame () );
AddFrame(toolbar);
toolbar.Set( THISBACK (MainToolBar) );
Title("Solving tranmission problem program").Icon(logo2(), logo1())
.MinimizeBox(1).Maximize();
WhenClose = THISBACK (Exit);
//WithAboutDlg<TopWindow> about;
CtrlLayout(*this);
}

AboutDlg :: AboutDlg ()
{
Title("About...").Icon(logo2(),logo1());
CtrlLayout(*this);
ok <<= THISBACK (Exit);
}

GUI_APP_MAIN
{
//int m,n;
Tranmission().Run();

}

In addition, there are 2 files: Tranmission.lay and Tranmission.iml, but they aren't involved with the problem (I think so Very Happy ). The parts of source code that are after "//" and covered by /*....*/ are just be add to source afterwards. And these are error descriptions:

Linking...
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl logo2(void)" (?logo2@@YAABVImage@
@XZ) referenced in function "public: __thiscall transport::transport(void)" (??0transport<a href="mailto:@@QAE" target="_blank">@@QAE</a>@XZ)
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl logo1(void)" (?logo1@@YAABVImage@
@XZ) referenced in function "public: __thiscall transport::transport(void)" (??0transport<a href="mailto:@@QAE" target="_blank">@@QAE</a>@XZ)
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl imgSave(void)" (?imgSave@@YAABVIm
age@@XZ) referenced in function "private: void __thiscall transport::Menu1(class Bar &)" (?Menu1@transport@@AAE
XAAVBar@@@Z)
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl imgOpen(void)" (?imgOpen@@YAABVIm
age@@XZ) referenced in function "private: void __thiscall transport::Menu1(class Bar &)" (?Menu1@transport@@AAE
XAAVBar@@@Z)
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl imgNew(void)" (?imgNew@@YAABVImag
e@@XZ) referenced in function "private: void __thiscall transport::Menu1(class Bar &)" (?Menu1@transport@@AAEXA
AVBar@@@Z)
main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl imgHelp(void)" (?imgHelp@@YAABVIm
age@@XZ) referenced in function "private: void __thiscall transport::Menu2(class Bar &)" (?Menu2@transport@@AAE
XAAVBar@@@Z)
e:\upp\out\transport\MSC71.Debug_full.Gui.Main\transport.exe : fatal error LNK1120: 6 unresolved externals

There were errors. (0:00.60)

Please, help me. I dont know what happen. It's just the start to make interface, even I have not yet go to the main part of program. When I build any examples contained with U++, it's good.

[Updated on: Wed, 03 May 2006 01:09] by Moderator

Report message to a moderator

Re: Please, Help me! [message #390 is a reply to message #389] Sun, 11 December 2005 11:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
mechatronic wrote on Sun, 11 December 2005 05:23


#include "Tranmission.h"

//#define IMAGEFILE <Tranmission/Tranmission.iml>
//#include <Draw/iml_source.h>


main.obj : error LNK2019: unresolved external symbol "class Image const & __cdecl logo2(void)" (?logo2@@YAABVImage@
@XZ) referenced in function "public: __thiscall transport::transport(void)" (??0transport<a href="mailto:@@QAE" target="_blank">@@QAE</a>@XZ)



The problem is caused by those two lines being commented out - those lines are needed to create "Image constants" - those symbols that linker lists as unresolved.
Re: Please, Help me! [message #391 is a reply to message #390] Sun, 11 December 2005 11:46 Go to previous messageGo to next message
mechatronic is currently offline  mechatronic
Messages: 10
Registered: December 2005
Location: Viet Nam
Promising Member

But when I built it first, it was correct. After I added the parts that cover by /* ... */ and after //..., it was fail, and I've tried to solve by deleting them,..., I have not solved it yet. I think they're not involved with these bugs.

PS: Please replace Tranmission by Transport, it's new name. But these errors have presented.

[Updated on: Sun, 11 December 2005 11:48]

Report message to a moderator

Re: Please, Help me! [message #393 is a reply to message #391] Sun, 11 December 2005 12:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
mechatronic wrote on Sun, 11 December 2005 05:46

But when I built it first, it was correct. After I added the parts that cover by /* ... */ and after //..., it was fail, and I've tried to solve by deleting them,..., I have not solved it yet. I think they're not involved with these bugs.

PS: Please replace Tranmission by Transport, it's new name. But these errors have presented.



Well, those errors you have listed are 100% caused by those two lines commented.

If uncommenting then produces another set of errors, it is another issue - I do not have enought information to resolve errors I am not aware of Smile

However, consider packing your package (dir that contains those files) using zip (all files!) and uploading to the forum. Then I can easily check it/fix it... post back
Re: Please, Help me! [message #425 is a reply to message #393] Mon, 26 December 2005 14:19 Go to previous messageGo to next message
mechatronic is currently offline  mechatronic
Messages: 10
Registered: December 2005
Location: Viet Nam
Promising Member

Sorry, I'm in my exam time, so I've closed this project, but I'll put its files up later. I think the header file image.h has bugs, If I add icon to file iml and use them for my application, it will has those error, and everything's good unless using them.
I will post it soon.Very Happy
Re: Please, Help me! [message #2995 is a reply to message #425] Wed, 03 May 2006 01:11 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
if you post, please help me... by creating a good topic name... Smile
Previous Topic: Using value from EditInt
Next Topic: Newbie Problems with the menu example...
Goto Forum:
  


Current Time: Sat Jun 15 17:01:48 CEST 2024

Total time taken to generate the page: 0.02545 seconds