Hi,
I have Structure in C, program and the structure is being used with
various function inside C coding but am getting undefined referenced
to global method and few of them too uses the sturct module.
my problem goes like this,
ex.h
-----------
#define NIL 0 /* Indicates ptr is nil */
#define NO_CODER 0 /* Means do not use an arithmetic
coder */
#define DEFAULT_CODER 1 /* Default arithmetic coder */
#define FALSE 0 /* For boolean expressions */
#define TRUE 1 /* For boolean expressions */
typedef unsigned int boolean;
extern unsigned int debugModel;
typedef struct debugType
{
unsigned int level;
unsigned int level1;
unsigned int progress;
unsigned int range;
unsigned int coder;
unsigned int coder_target;
unsigned int codelengths;
}debugType;
extern struct debugType Debug;
//main function for .c file
void usage(void);
void loadModels(FILE *fp);
void init_arguments( int argc, char *argv[]);
unsigned int *getText (FILE *fp, unsigned int eoln, unsigned int
del_last_eoln, unsigned int *len);
float codelengthText (unsigned int model, unsigned int *text, unsigned
int textlen);
void codelengthModel s (unsigned int *text, unsigned int textlen);
//gloabal function for .c file running with local function
extern unsigned int TLM_create_cont ext (unsigned int model);
extern void TLM_set_context _operation (unsigned int
context_operati on);
extern void TLM_update_cont ext (unsigned int model, unsigned int
context, unsigned int symbol);
extern void TLM_release_con text (unsigned int model, unsigned int
context);
extern void TLM_dump_models (unsigned int file, void
(*dump_symbol_f unction) (unsigned int, unsigned int));
extern void TLM_set_tag (unsigned int model, char *tag);
---------------------------------------------------------------------
ex.c
--------
#include "ex.h"
int Exclude_eolns = 0; /* For incuding/excluding eolns in the input
*/
int Delete_last_eol n = 0; /* For deleting the last eoln read in from
the input */
int Debug_model = 0; /* For dumping out the model */
int Debug_chars = 0; /* For dumping out the codelength character
by character */
int Display_entropy = 0; /* For displaying cross-entropies and not
codelengths */
unsigned int TLM_Coderanges;
float TLM_Codelength;
unsigned int TLM_Context_Ope ration;
void loadModels (FILE * fp)
/* Load the models from file FP. */
{
char tag [MAX_TAG], filename [MAX_FILENAME];
//char tag [256], filename [256];
unsigned int model;
while ((fscanf (fp, "%s %s", tag, filename) != EOF))
{
model = TLM_read_model( filename, "Loading model from file",
"Codelength : can't open model file");
TLM_set_tag (model, tag);
}
}
void init_arguments (int argc, char *argv[])
{
char *optarg; //extern char *optarg;
int optind; //extern int optind;
FILE *fp;
unsigned int models_found;
int opt;
/* get the argument options */
models_found = 0;
Exclude_eolns = 0;
Delete_last_eol n = 1;
while ((opt = getopt (argc, argv, "ELcd:em:r" )) != -1)
switch (opt)
{
case 'E':
Exclude_eolns = 1;
break;
case 'L':
Delete_last_eol n = 1;
break;
case 'c':
Debug_chars = 1;
break;
case 'd':
Debug_model = atoi (optarg);
break;
case 'e':
Display_entropy = 1;
break;
case 'm':
fprintf (stderr, "Loading models from file %s\n",
optarg);
if ((fp = fopen (optarg, "r")) == NULL)
{
fprintf (stderr, "Encode: can't open models file %s\n",
optarg);
exit (1);
}
loadModels (fp);
models_found = 1;
break;
case 'r':
Debug.range = 1; //uses structure element range.
break;
default:
usage ();
break;
}
if (!models_found)
{
fprintf (stderr, "\nFatal error: missing models\n\n");
usage ();
}
for (; optind < argc; optind++)
usage ();
}
----------------------------------------------------------------------------------------------------------------------------------
but while running setup.py build with distutils it's showing error as
_ex.o: In function 'init_arguments ':
_ex.c :89: undefined reference to _TLM_read_model
_ex.c :95: undefined reference to _TLM_set_tag
for all the global function declared within .h file and the calling
method from .c file,
also how can the Debug.range can be used...
thank's
anish 2 1155
Anish Chapagain wrote:
but while running setup.py build with distutils it's showing error as
_ex.o: In function 'init_arguments ':
_ex.c :89: undefined reference to _TLM_read_model
_ex.c :95: undefined reference to _TLM_set_tag
for all the global function declared within .h file and the calling
method from .c file,
your code doesn't match the error messages, and doesn't seem to be a
Python extension at all. are you sure you posted this to the right
newsgroup?
</F>
On Aug 18, 8:43*pm, Fredrik Lundh <fred...@python ware.comwrote:
Anish Chapagain wrote:
but while running setup.py build with distutils it's showing error as
_ex.o: In function 'init_arguments ':
* * *_ex.c :89: undefined reference to _TLM_read_model
* * *_ex.c :95: *undefined reference to _TLM_set_tag
for all the global function declared within .h file and the calling
method from .c file,
your code doesn't match the error messages, and doesn't seem to be a
Python extension at all. *are you sure you posted this to the right
newsgroup?
</F>
hi,
i am thinking now that may be it;s realted to the cygwin package that
i'm using with python in win XP, but still mine .c file has structure
element and structure is in .h file so how can i pass on value to
structure element,
it shows as ex_debugType_ge t(), ex_debugType_se t()...can i assign
value to member creating own function..want some help for this...
thank's This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Hitillambeau |
last post by:
Hi guys,
As I am new to Python, i was wondering how to declare and use global
variables. Suppose i have the following structure in the same module (same
file):
def foo:
<instructions>
<instructions>
def bar:
<instructions>
|
by: Bryan Parkoff |
last post by:
….I would like to know which is the best optimization to use global
variable or global struct. I always tell C/C++ Compiler to turn on
optimization.
….I use underscore between first name and second name for better
readable. After optimization, global variables might be misaligned
because each global variables must be converted to 32 bits, but I do
see that C/C++ Compiler do padding between variables. Struct does the
same to do padding....
|
by: Bryan Parkoff |
last post by:
I know how to write "Pointer to Function" inside struct or class without
using static, but I have decided to add static to all functions inside
struct or class because I want member functions to be bound inside struct or
class to become global functions. It makes easier for me to use
"struct.memberfunction()" instead of "globalfunction()" when I have to use
dot between struct and member function rather than global function.
I do not have...
|
by: Anthony England |
last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled
error is encountered, but it seems that this also happens when the variable
is defined as private at form-level.
So if "global variables get re-set" doesn't tell the whole story, then what
does?
***please note***
I'm not looking for a solution - I'm looking for a more detailed description
of what happens when an un-handled error occurs - possibly with help file...
|
by: Spacen Jasset |
last post by:
The main two desirable things I feel error handling should provide are
these:
1) Debugging and diagnostic aid
2) User feedback
One method that is used a fair amount it to 'say' that all functions must
return an error code of a standard type, for example tError. Where tError is
typedefed as a long int. A list of error codes may then be defined in a
global header file, or perhaps upper bits of tError may indicate a module
| |
by: jcrouse |
last post by:
I am using the following code to trap errors in a sub routine:
Try
Executable code
Catch ex As Exception
Dim strInputE As String = Application.StartupPath & "\Error.txt"
Dim srE As StreamWriter = File.AppendText(strInputE)
srE.WriteLine(vbCr)
srE.WriteLine(vbCr)
srE.WriteLine(DateTime.Now)
|
by: Lysander |
last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access Security, but I'll start with something short and simple
This code was written in Access 2003 but should be valid in Access 2000
By default, when you start a new module, either in a form or report, or a global module, Access does not declare Option...
|
by: Cramer |
last post by:
Using ASP.NET 3.5: Can a custom HTTP Module be used to register for the
Application_Start event? Or _must_ I use Global.asax to work with
Application.Start?
I understand that I can use a custom HTTP Module to register for other
pipeline events (like Application.BeginRequest), but I was told that the
only place that I can set up an event handler for Application.Start is in
Global.asax.
My preference would be to register an HTTP Module...
|
by: arnuld |
last post by:
Can anyone point me to some online/offline document on error handling in C
?
I am doing some Socket Programming in C and feeling a lots of difficult in
error handling :(
Also some time ago some one told me that when I get an error then I can
create a generic function which, when called within some function will
print the name of that function automatically or something like that I
forgot. It had lots of #define(s) . Can someone write...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |