Hey guys...i had an assignment i did last year and i had a problem linking the my files since the program was modularized..the lecturer accepted it with the errors since she also failed to figure it out..anyway i was scrolling through my work and today and i saw the code then i remembered its solution is still a mystery.if there is anyone who would want to look at the whole program and see the problem it'll be great..i cant post it all cuz its modularized and it'll be really long and unpleasant to read..so if anyone wants to check it and give it a try then you can let me know so that i can attach it or something...by the way the code works well when it is not modularized. .this is not an urgent matter and neither is it homework so if anyone has the time to want to check it out they can let me know..thanks

zip the project up and attach it to a post. Don't include any object files or other files that are generated by the compiler. And it would be nice to know what operating system and compiler you tried to compile/link with.

i used visual studio to compile to compile it and the operating system is windows xp sp2

Has anyone looked at this code yet??

That zip does not include everything needed to compile and link the program. I need ALL the source files including all the *.c and *.h files in the project.

i dont get what kind of files you want but what is included in the zip is the main program, the source files and the header files..what else do i need to provide??

check the zip file again -- it only contains 3ds.c and 3ds.h. There is no main() function in that *.c file. You said there are multiple files -- so where are they ?

the zip files contains 5cpp files and the "main.cpp" is the main..it also contains 4 header files..i was trying to modularize it.used the main.cpp to compile and run but it was giving me these 3 errors...:

main.obj : error LNK2001: unresolved external symbol "double __cdecl call_cost(void)" (?call_cost@@YANXZ)

main.obj : error LNK2001: unresolved external symbol "void __cdecl time_increment(int &,int &,double &,double &,double &,struct time_info &,struct time_info &)" (?time_increment@@YAXAAH0AAN11AAUtime_info@@2@Z)

main.obj : error LNK2001: unresolved external symbol "double __cdecl equality(void)" (?equality@@YANXZ)

You are right -- I re-downloaded your zip and it contained the files you mentioned. Using VC++ 2008 Express I created a new empty project and added the files in your zip to it. I get millions (?) of errors.

Your program will not link with all those errors. You have to correct the errors first.

For example: for(a=temp_value;a<7;i++) found in CallCost.cpp. There are two things wrong with that line: 1) temp_value is a double and a is an integer, and 2) i++ is incrementing the wrong counter.

oh..that was unnoticed..anyway the whole code works perfectly well when it is not modularized and also after i modularize it, it compiles with no errors but cannot build..i havent got any syntax or any other kind of errors apart from the "LNK2001" and that is when i build so i dont know what kind of errors you seem to be getting

In the project settings in the IDE, you need to list ALL the source files (all 5 of them).

thanx salem..I now see why it was giving me the LNK errors..now another twist about those so many errors acient dragon was talking about..i cant figure out why it keeps saying S is redifined...i defined it in 2 header files but if i take it out from one then it will say S is undefined..also it gives me "syntax error identifier time_info" i seem to fail to figure out the problem..

>> i defined it in 2 header files but if i take it out from one then it will say S is undefined
Define it only once, and use #include "where_S_is_defined.h" where needed (i.e. where you get the 'undefined' error)

am getting this error from the header file userinput.h and yet S is not redifined anywhere
'S' : redefinition; different storage class

am also getting the same error but without the "different storage class" part..for the structures time_info and time_date..i dont know what is goin on

A couple of things
1. Each header file needs include guards, eg

#ifndef TIMEANDDATE_H_INCLUDED
#define TIMEANDDATE_H_INCLUDED
#include <iostream>

double hour();

double minute();

double day();

double month();

double year();

double value();
#endif

2. counter.h needs userinput.h because of S.

thanx alot salem...that was something new to me..anyway am now getting this error that i have failed to understand..

TimeAndDate.obj : error LNK2005: "struct time_details * time_and_date" (?time_and_date@@3PAUtime_details@@A) already defined in main.obj

> time_details time_and_date[S];
Each time you include this, you end up with another instance. With more than one instance, you get the multiply declared symbols.

Put this in the .h file
extern time_details time_and_date[S];

Put this in ONE of the .cpp files
time_details time_and_date[S];

ok..i did that but i cant figure out how i can use the extern for the structure..

The same way as you use it at the moment.

Making it extern doesn't change the way you use it, in the same way that only having a prototype of a function doesn't affect your ability to call the function.

when i declare the struct like this i get the warning below

extern struct time_details 

{

	time_info start;

	time_info end;
 
};

warning C4091: 'extern ' : ignored on left of 'struct time_details' when no variable is declared

You can't declare a struct as extern, only an instance of a struct.

As in
extern struct time_details aTime;

That's what the "when no variable is declared" is trying to tell you.

i had already tried it that way but the i couldnt figure out the definition..i have tried using
struct time_details start, end;
struct time_details start;
etc but they fail to work..could you also give me like a brief explanation on how the extern is to be used when to use it etc..thanx

hi,

I try to compile your file, it is compliling with out error.

I user Buildr Borlond.

@ibarakat2003
you are right...it compiles with no errors but you will get the errors when you build...have you tried to build it??

it compiles with no errors @ibarakat2003...but it cannot build..(you get the errors)..try building it

havent tried using that compiler...try using visual studio 6.0

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.