Question

How can I run this C code

Asked by: tempMemory


hi,
 I'm interested in an algorithm that was implemented in C. I have little experience in C language, so I couldn't run the code.

the algorithm (named TLR) used a library also implemented in C (named libtissue). I tried running the TLR but I keep getting an error of header not found , although the headers are included.

http://www.asap.cs.nott.ac.uk/~ais/software/
(tlr-lt-0.1.tar.gz  &  libtissue-1.0.1.tar.gz )

I'm not sure where the problem rely? is it in the code? is there a missing file? or is it me who didn't know how to run it.

can any one help?
thank you

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-06-09 at 12:36:27ID24477109
Tags

an algorithm implemented in c

Topics

C Programming Language

,

CYGWIN

Participating Experts
3
Points
500
Comments
56

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. untaring a file .gz
    Hello, I am trying to untar a file called analog_2_11_tar.gz and I am getting the following message: -rw-r--r-- 1 absynthe vuser 153401 Sep 10 00:30 analog2_11_tar.gz absynthe: {5} % tar -xvf analog2_11_tar.gz tar: Cannot identify format. Searching... tar: Cpio file nam...
  2. EASY: C scripts and tar.gz
    I have two easy questions... 1.) How do I compile C source code scripts. How do I modify them? 2.) How do I unzip tar.gz files? thanks for your help

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Infinity08Posted on 2009-06-09 at 12:40:10ID: 24584894

What is the error you get ?

 

by: tempMemoryPosted on 2009-06-09 at 13:58:42ID: 24585740

include<tissue.h> not found

 

by: tempMemoryPosted on 2009-06-09 at 14:10:45ID: 24585854

I tried to run it using visual studio 2005.
although the files are all there, it generates many errors . first error states that it cannot find tissue.h !

 

by: Infinity08Posted on 2009-06-09 at 15:40:01ID: 24586525

>> include<tissue.h> not found

Are you sure that's the exact error message ?

 

by: tempMemoryPosted on 2009-06-09 at 16:36:18ID: 24586893

I copied the error message bellow

tlr-lt.c:7:20: tissue.h: No such file or directory


 

by: Infinity08Posted on 2009-06-09 at 16:39:31ID: 24586915

Are the header file(s) for libtissue installed in the include path ? Either the system's or compiler's include directory, the project directory, or another directory that was specified in the compilation command ?

 

by: tempMemoryPosted on 2009-06-09 at 16:44:41ID: 24586942

I put them in the project directory , and then build the project. But I got the error along with others of the same nature

 

by: Infinity08Posted on 2009-06-09 at 16:52:10ID: 24587001

Can you show the contents of your project directory ?

 

by: jhshuklaPosted on 2009-06-09 at 16:52:10ID: 24587002

if you put them in the project directory, you probably need to change from <tissue.h> to "tissue.h"

 

by: Infinity08Posted on 2009-06-09 at 16:52:51ID: 24587005

>> you probably need to change from <tissue.h> to "tissue.h"

<> should also look in the current directory.

 

by: Infinity08Posted on 2009-06-09 at 16:54:33ID: 24587013

I've got to get some sleep now, so I'll leave it to you, jhshukla :)

 

by: tempMemoryPosted on 2009-06-09 at 17:04:42ID: 24587067

thank you it did solve the problem of tissue.h :)

but know I have another error

#include <asm/unistd.h>
13:24: asm/unistd.h: No such file or directory

isn't asm/unistd.h a built in like math.h?


 

by: ozoPosted on 2009-06-09 at 22:47:06ID: 24588277

<unistd.h> is standard on POSIX compatible systems.  I'm not sure about <asm/unistd.h>
Is there a unistd.h file anywhere on your system?  is it in /usr/include?

 

by: Infinity08Posted on 2009-06-09 at 22:51:40ID: 24588291

>> isn't asm/unistd.h a built in like math.h?

The <unistd.h> file is quite standard on Unix like platforms, but <asm/unistd.h> less so, especially since you're apparently doing this in CYGWIN.

 

by: Infinity08Posted on 2009-06-09 at 22:52:29ID: 24588296

Sorry ozo - forgot to refresh.

 

by: tempMemoryPosted on 2009-06-09 at 23:06:49ID: 24588337

OK thank you all

here is what I'm going to do I'll remove asm/ part and see what I'll get

 

by: Infinity08Posted on 2009-06-10 at 01:10:06ID: 24588884

>> <> should also look in the current directory.

Btw, I just realized I've been "spoiled" by my current setup - what I said earlier is not true in the general case heh.

 

by: tempMemoryPosted on 2009-06-10 at 03:43:19ID: 24589735

hello again,
 
 unistd.h error is gone now :)

and of course I got another

in tlr, I got this error:

tlr-lt.c: In function `random_lock':
tlr-lt.c:178: error: `nsyscalls' undeclared (first use in this function)

although it was declared in syscall (attached)

/******************************************************************************/
/* tlr                                                                        */
/* (c) 2006 jamie twycross, jpt AT cs.nott.ac.uk                              */
/* released under gnu gpl v2                                                  */
/******************************************************************************/
 
#include "tissue.h"
#include "syscall.h"
 
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
.
.
.
/* create antigen receptor */
/* 4 characters - syscall number as 4-digit hex */
Antigen *random_lock(void)
{
	Antigen *lock = NULL;
	static char line[64];
	static int sc;
	register unsigned int i;
 
	while(!lock) {
		/* set lock to random syscall number */
		sc = (int) (((double) nsyscalls * rand()) / (RAND_MAX + 1.0));
		snprintf(line, sizeof(line), "%.4x", sc);
		lock = set_antigen(lock, line);
		/* check to see not known antigen */
		for(i = 0; i < num_known_antigen; i++)
			if(antigen_match(lock, known_antigen[i])) {
				lock = NULL;
				break;
			}
	}
 
	return lock;}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:

Select allOpen in new window

 

by: Infinity08Posted on 2009-06-10 at 04:52:10ID: 24590237

In order to use it in tlr-lt.c, you'll need to tell the compiler that it's defined elsewhere by adding this :

        extern const unsigned int nsyscalls;

to the tlr-lt.c file.

You'll also need to remove the 'static' at the start of the nsyscalls definition in syscall.c so that it becomes :

        const unsigned int nsyscalls = sizeof sysent / sizeof sysent[0];

 

by: tempMemoryPosted on 2009-06-10 at 06:58:48ID: 24591527

thank you a lot, you are saving me here :)

I have this error
tlr-lt.c: In function `main':
tlr-lt.c:665: warning: passing arg 2 of `init_tissue' makes pointer from integer without a cast
tlr-lt.c:665: error: too few arguments to function `init_tissue'

I know that I should pass socket name as a parameter to
init_tissue((int16_t) ts_port, max_antigen, max_cytokines, \
                  max_cells);

so it will become some thing like
init_tissue((int16_t) ts_port, sockname,  max_antigen, max_cytokines, \
                  max_cells)

the thing is that I didn't find it in the  parameter file (the initialization file, that is read by tlr)

/******************************************************************************/
/* tlr                                                                        */
/* (c) 2006 jamie twycross, jpt AT cs.nott.ac.uk                              */
/* released under gnu gpl v2                                                  */
/******************************************************************************/
 
//changed 
#include "tissue.h"
#include "syscall.h"
 
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
 
/* model parameters */
unsigned int max_antigen;
unsigned int antigen_multiplier;
unsigned int max_cytokines;
unsigned int max_cells;
unsigned int cell_update_rate;
unsigned int num_cells_1;
unsigned int cell_lifespan_1;
unsigned int num_antigen_1;
unsigned int num_antigen_receptors_1;
unsigned int num_antigen_producers_1;
unsigned int antigen_producer_action_time;
unsigned int num_cytokine_receptors_1;
unsigned int num_cells_2;
unsigned int cell_lifespan_2;
unsigned int num_cell_receptors_2;
unsigned int num_vr_receptors_2;
unsigned int num_progeny_2;
unsigned int cell_lifespan_3;
unsigned int cell_lifespan_4;
unsigned int cell_lifespan_5;
unsigned int ts_port = TS_DEFAULT_PORT;
unsigned int log_tissue = 0;
unsigned int probe_rate = 0;
 
char parameter_file[1024] = "";
char known_antigen_file[1024] = "";
char known_signals_file[1024] = "";
 
unsigned int num_known_antigen, num_known_signals;
Antigen **known_antigen;
Signal **known_signals;
 
// change
  extern const unsigned int nsyscalls;//added
  
unsigned int uniqueid = 1;
.
.
.
int main(int argc, char **argv)
{
	Tissue *tissue;
	register unsigned int i, j, k, ind;
	Antigen *lock;
 
	parse_command_line(argc, argv);
 
	/* create a tissue compartment */
	tissue = init_tissue((int16_t) ts_port, max_antigen, max_cytokines, \
			max_cells);
.
.
.}
-----------------------------------------------------------------------
/******************************************************************************/
/* (c) 2006 jamie twycross, jpt AT cs.nott.ac.uk                              */
/* released under gnu gpl v2                                                  */
/* tissue api                                                                 */
/******************************************************************************/
 
#include "tissue.h"
 
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <time.h>
#include <arpa/inet.h>
/*my change <netinet/sctp.h>*/
#include <netinet/tcp.h>
#include <netdb.h>
#include <strings.h>
#include <string.h>
#include <errno.h>
#include <err.h>
.
.
.
/* initialise the tissue */
Tissue *init_tissue(const uint16_t server_port,
		const char *sockname,
		const unsigned int num_antigen,
		const unsigned int num_cytokines,
		const unsigned int num_cells)
{
	Tissue *tissue;
	static int done;
	unsigned int i;
	struct sigaction siga;
	struct nbio *l;
 
	srand(time(NULL));
	srand48(time(NULL));
	
	if ( done == 0 ) {
		eventloop_poll_ctor();
		eventloop_epoll_ctor();
		done = 1;
	}
 
	/* setup logfile */
	open_logfile();
	logtime_tissue("starting tissue server");
 
	/* allocate memory */
	if(!(tissue = calloc(1, sizeof(Tissue))))
		logfatal_tissue("couldn't allocate memory for tissue");
 
	if ( !nbio_init(&tissue->nbio, NULL) )
		logfatal_tissue("couldn't initialize nonblocking I/O");
 
	tissue->num_antigen = num_antigen;
	if(tissue->num_antigen)
		if(!(tissue->antigen = calloc(tissue->num_antigen, sizeof(Antigen *))))
			logfatal_tissue("couldn't allocate memory for antigen");
	tissue->num_cytokines = num_cytokines;
	if(tissue->num_cytokines) {
		if(!(tissue->cytokine = calloc(tissue->num_cytokines, \
				sizeof(Cytokine *))))
			logfatal_tissue("couldn't allocate memory for cytokines");
		if(!(tissue->cytokine_type = calloc(tissue->num_cytokines, \
				sizeof(int))))
			logfatal_tissue("couldn't allocate memory for cytokine types");
		for(i = 0; i < tissue->num_cytokines; i++) {
			tissue->cytokine[i] = init_cytokine();
			tissue->cytokine[i]->id = i;
			tissue->cytokine_type[i] = DEF_CYTOKINE_TYPE;
		}
	}
	tissue->num_cells = num_cells;
	if(tissue->num_cells)
		if(!(tissue->cell = calloc(tissue->num_cells, sizeof(Cell *))))
			logfatal_tissue("couldn't allocate memory for cells");
 
	/* capture INT to exit cleanly */
	tcopy = tissue;
	siga.sa_handler = sigint_handler;
	sigemptyset(&siga.sa_mask);
	siga.sa_flags = SA_RESTART;
	if(sigaction(SIGINT, &siga, NULL) == -1)
		logfatal_tissue("couldn't setup sigint handler");
 
	/* set defaults */
	tissue->log = 0;  /* no logging of server */
	tissue->cytokine_decay_rate = DEF_DECAY_RATE;  /* cytokine decay rate */
	tissue->antigen_multiplier = 1;  /* how many copies of incoming antigen */
/*my change IPPORTO_stpc*/
	l = listener_inet(IPPROTO_TCP, INADDR_ANY,
				(server_port) ? server_port : TS_DEFAULT_PORT,
				accept_cb, tissue);
	if ( l == NULL )
		logfatal_tissue("couldn't create remote server socket");
	tissue->remote_svr = l;
	listener_add(&tissue->nbio, l);
 
	if ( sockname ) {
		l = listener_unix(sockname, accept_cb, tissue);
		if ( l == NULL )
			logfatal_tissue("couldn't create local server socket");
 
		tissue->local_svr = l;
		listener_add(&tissue->nbio, l);
	}
 
	INIT_LIST_HEAD(&tissue->clients);
	INIT_LIST_HEAD(&tissue->timers);
	return tissue;
}
.
.
.
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:

Select allOpen in new window

 

by: tempMemoryPosted on 2009-06-10 at 07:05:28ID: 24591609

to tlr I added

char *sockname="";

and the error was gone of course :) but I'm not sure if it will function correctly
 

 

by: Infinity08Posted on 2009-06-10 at 07:57:10ID: 24592304

Are you sure that the tissue library is the right version for the tlr-lt code ?


>> to tlr I added
>> 
>> char *sockname="";

I don't know the library, so I can't tell you ... You'll have to find out by testing :)

 

by: tempMemoryPosted on 2009-06-10 at 08:23:37ID: 24592723

I used the latest versions as the author recommended

I'm testing it right now but I got these warning , I'll look into them. and then ask you of course :)

 

by: Infinity08Posted on 2009-06-10 at 08:41:26ID: 24592926

>> I'm testing it right now but I got these warning , I'll look into them. and then ask you of course :)

Good :)

 

by: tempMemoryPosted on 2009-06-11 at 04:15:18ID: 24600748

hello,

Infinity08, you were right there was some missing functions in libtissue that I found in previous versions :)

now I run the project and I got the following message :

------------------------------------------------------------------------------------------------------------------------------
Running "C:\cygwin\bin\make.exe  -f Makefile CONF=Debug clean" in C:\Documents and Settings\R AM\My Documents\NetBeansProjects\Application_1

rm -f *.o *~ tlr-lt tissue.log

Clean successful. Exit value 0.

Running "C:\cygwin\bin\make.exe  -f Makefile CONF=Debug" in C:\Documents and Settings\R AM\My Documents\NetBeansProjects\Application_1

gcc -Wall -O2 -g  -lpthread -ltissue -lm -o tlr-lt tlr-lt.c
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -ltissue
collect2: ld returned 1 exit status
make: *** [tlr-lt] Error 1

Build failed. Exit value 2.
------------------------------------------------------------------------------------------------------------------------------
 

 

by: Infinity08Posted on 2009-06-11 at 07:31:34ID: 24602785

>> Infinity08, you were right there was some missing functions in libtissue that I found in previous versions :)

So, I assume you're now using the right version of the library ?


>> cannot find -ltissue

is libtissue.a where it's supposed to be ?

 

by: tempMemoryPosted on 2009-06-11 at 09:04:10ID: 24603925

I hope I'm using the correct version now

>> is libtissue.a where it's supposed to be ?

I'm not sure I understand your question
do you mean the program is expecting to find a file in some folder called libtissue.a? because I don't have such a folder

 

by: Infinity08Posted on 2009-06-11 at 09:09:50ID: 24603989

The tissue library (probably named libtissue.a) - where did you put it ?

 

by: tempMemoryPosted on 2009-06-11 at 10:04:09ID: 24604509

I add it in the same folder as project folder

 

by: Infinity08Posted on 2009-06-11 at 10:50:11ID: 24604900

>> I add it in the same folder as project folder

What's its name ?

 

by: tempMemoryPosted on 2009-06-11 at 11:14:04ID: 24605123

the folder name: Application_1

 

by: Infinity08Posted on 2009-06-11 at 11:16:43ID: 24605149

>> the folder name: Application_1

No, the compiled library itself. It's one file (likely named libtissue.a), which is the result of compiling the library.

 

by: tempMemoryPosted on 2009-06-11 at 11:47:31ID: 24605477

I didn't use the library as a library. I took the files and add it directly to the project folder

so there is no complied library

 

by: Infinity08Posted on 2009-06-11 at 11:48:44ID: 24605489

>> so there is no complied library

Right, so then you also don't have to link against it :)

 

by: tempMemoryPosted on 2009-06-11 at 12:24:17ID: 24605844

sorry, but I don't understand! does that mean that there is no error?

then what does the message mean? why did it stop running?

 

 

by: Infinity08Posted on 2009-06-11 at 12:34:20ID: 24605953

The -ltissue part in the command line tells the linker to link against the libtissue.a library. Since you're not using that library, you shouldn't specify it on the command line.

 

by: tempMemoryPosted on 2009-06-11 at 13:02:04ID: 24606238

OK, I think I'm starting to understand :)

I have to change the makefile, right?

I did some changing (by guessing of course), but got an "undefined reference" errors

I know that I'm asking too much, but I really need to run this program :(

I really appreciate your help

CFLAGS=-Wall -O2 -g
CINCS=
CLIBS=-lpthread -ltissue -lm
CINCS_STATIC=-I${HOME}/opt/libtissue
CLIBS_STATIC=-lm -L${HOME}/opt/libtissue
 
all: tlr-lt 
 
tlr-lt:
	gcc $(CFLAGS) $(CINCS) $(CLIBS) -o tlr-lt tlr-lt.c
 
tlr-lt-static:
	gcc $(CFLAGS) $(CINCS_STATIC) $(CLIBS_STATIC) -o tlr-lt tlr-lt.c
 
install: uninstall
	install tlr-lt $(HOME)/bin
 
uninstall:
	rm -f $(HOME)/bin/tlr-lt
 
clean:
	rm -f *.o *~ tlr-lt tissue.log
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:

Select allOpen in new window

 

by: Infinity08Posted on 2009-06-11 at 13:20:21ID: 24606422

>> CLIBS=-lpthread -ltissue -lm

This is the line that specifies the libraries the code should be linked to. Just take out the tissue library, and rebuild it.

 

by: tempMemoryPosted on 2009-06-11 at 13:25:05ID: 24606492

that is what I did before but I got an undefined reference errors

e.g.
/cygdrive/c/Documents and Settings/R AM/My Documents/NetBeansProjects/Application_1/tlr-lt.c:81: undefined reference to `_writelog_tissue'

 

by: Infinity08Posted on 2009-06-11 at 14:21:49ID: 24607017

>> undefined reference to `_writelog_tissue'

Since you're not building the library as a library, you'll have to compile it as separate object files, and then link all of those into your application ...

(note that it would have been easier to just build the library - it saves you a lot of this trouble)

 

by: tempMemoryPosted on 2009-06-12 at 00:31:10ID: 24609929

OK, I'll add it as a library as you  advise.

 

by: tempMemoryPosted on 2009-06-12 at 09:43:47ID: 24613942

hello again,

here is what I've been doing:
I create a project named tissue and successfully complied it
I created another project named tlr-lt and add tissue as its library

but when I build tlr-lt I got the same error
------------------------------------------------------------------------------------------------------------------------------
Running "C:\cygwin\bin\make.exe  -f Makefile CONF=Debug" in C:\Documents and Settings\R AM\My Documents\NetBeansProjects\tlr-lt

gcc -Wall -O2 -g  -lpthread -ltissue -lm -o tlr-lt tlr-lt.c
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -ltissue
collect2: ld returned 1 exit status
make: *** [tlr-lt] Error 1

Build failed. Exit value 2.
------------------------------------------------------------------------------------------------------------------------------

so I tried removing ltissue from
 CLIBS=-lpthread -ltissue -lm

and I got a previous error
-----------------------------------------------------------------------------------------------------------------------------
Running "C:\cygwin\bin\make.exe  -f Makefile CONF=Debug" in C:\Documents and Settings\R AM\My Documents\NetBeansProjects\tlr-lt

gcc -Wall -O2 -g  -lpthread -lm -o tlr-lt tlr-lt.c
/cygdrive/c/DOCUME~1/RAM~1/LOCALS~1/Temp/cclYyGob.o: In function `probe_tissue':
/cygdrive/c/Documents and Settings/R AM/My Documents/NetBeansProjects/tlr-lt/tlr-lt.c:81: undefined reference to `_writelog_tissue'
.
.
.
------------------------------------------------------------------------------------------------------------------------------

:(

 

by: Infinity08Posted on 2009-06-12 at 09:49:04ID: 24613972

What's the name of the compiled tissue library, and where is it located ?

 

by: tempMemoryPosted on 2009-06-12 at 10:05:18ID: 24614099


libtissue.a  is located in

C:\Documents and Settings\R AM\My Documents\NetBeansProjects\tissue\dist\Debug\Cygwin-Windows

 

by: Infinity08Posted on 2009-06-13 at 01:06:49ID: 24618182

>> libtissue.a  is located in

And is that directory in your library search path ? Try placing libtissue.a in the project folder instead and see what happens.

 

by: tempMemoryPosted on 2009-06-13 at 01:26:30ID: 24618229

yes it is in project library path

I'll try what you suggested (placing libtissue.a in the project folder instead), and give you the feed back

thank you :)

 

by: Infinity08Posted on 2009-06-13 at 01:32:55ID: 24618251

What do you mean by "project" btw ? Aren't you just using the makefiles ?

 

by: tempMemoryPosted on 2009-06-13 at 01:47:35ID: 24618292

I mean by project: source and header files

to run the code I build the project, that is what I mean

 

by: Infinity08Posted on 2009-06-13 at 04:42:26ID: 24618751

ok. I thought you were using some kind of IDE ;) Let me know what the progress is on http:#24618229

 

by: tempMemoryPosted on 2009-06-13 at 06:15:41ID: 24619060

I am o-o

i'm using NetBeans IDE with cygwin compiler. is it what causing run problems? should I get back to visual studio ?

I tried placing libtissue.a in project folder but no change ( cannot find -ltissue )

 

by: Infinity08Posted on 2009-06-13 at 06:35:35ID: 24619146

>> i'm using NetBeans IDE

Well, it depends on your project set-up.

Just to eliminate a badly set-up project, try running the compilation command from the command line. ie. navigate to the directory that contains both tlr-lt.c and libtissue.a, and then execute :

        gcc -Wall -O2 -g  -lpthread -ltissue -lm -o tlr-lt tlr-lt.c

 

by: tempMemoryPosted on 2009-06-13 at 09:25:09ID: 24619745

>>try running the compilation command from the command line. ie. navigate to the directory that contains both tlr-lt.c and libtissue.a, and then execute :

        gcc -Wall -O2 -g  -lpthread -ltissue -lm -o tlr-lt tlr-lt.c

got this message

'gcc' is not recognized as an internal or external command, operable program or batch file.

 

by: Infinity08Posted on 2009-06-13 at 11:28:30ID: 24620251

That means your PATH variable isn't set correctly. Just add the path where gcc is installed. Something like :

        C:\path\to\gcc ...

Alternatively, you can always make sure that the PATH variable contains the directory that holds the gcc executable.

 

by: tempMemoryPosted on 2009-06-13 at 13:19:39ID: 24620604

I did add it to the PATH variable but nothing changes

I'll give up here. first, because I have to complete a report about this before wed. and second I have consumed your time.

thank you


 

by: tempMemoryPosted on 2009-06-13 at 13:34:27ID: 31590592

thank you so much. I really appreciate your help :)

 

by: Infinity08Posted on 2009-06-13 at 22:11:43ID: 24621896

When the environment is set up correctly, it should be quite straightforward to just run the two makefiles, and there shouldn't be a problem. So there is something wrong in your set up somewhere ...

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...