-
January 7th, 2009, 12:33 PM
#1
build a project using given obj files
Hello guys,
Sorry it might sounds silly, but how can I build a solution using given obj files and several cpp files in vs2005?
Thank you so much!
-
January 7th, 2009, 01:01 PM
#2
Re: build a project using given obj files
Hi!
Create a new solution/project and the add all the existing cpp files to it.
Obj files are intermediate files generated during compilation. You do not need those.
Nobody cares how it works as long as it works
-
January 7th, 2009, 01:05 PM
#3
Re: build a project using given obj files
Thank you for your response. The thing is, im building a project and part of the code is hidden. I was only given some of the obj files and im supposed to link those in my solution.....not sure how to do that since never did that before :-|
Tried doing that in properties dialog, but no luck. Any help will be much appreciated.
Thanks again!
-
January 7th, 2009, 01:14 PM
#4
Re: build a project using given obj files
I see.
Never done this, but if you go into your project settings and look in the "Link" section there is a field where you can enter "Object/library modules".
The common use of this field is to enter the .lib files, but .obj files might work as well. Give it a try.
Nobody cares how it works as long as it works
-
January 7th, 2009, 01:40 PM
#5
Re: build a project using given obj files
You can add them to your project just as if they were a .cpp file.
-
January 7th, 2009, 03:01 PM
#6
Re: build a project using given obj files
Thank you anyways
-
January 7th, 2009, 03:03 PM
#7
Re: build a project using given obj files
Originally Posted by lqakane
Thank you anyways
Is your question not answered?
-
January 8th, 2009, 09:56 AM
#8
link external obj files in vs 2005
Dear everyone:
I asked a similar question here yesterday. So basically I am trying to link some given obj files as if they are static libraries. For example if I have action.obj somewhere, I right click on the project name and chose "add->existing item" and simply added action.obj file under the project. It's not compiling....so im wondering if i should do anything in my header files like #include<action.obj>, but im not sure how to do that...any one has any thoughts?
Thank you soooo much.
-
January 8th, 2009, 09:59 AM
#9
Re: link external obj files in vs 2005
What do you mean "it's not compiling". I told you in your other thread (which you should have bumped instead of starting another thread) that just adding them to the project should be all you need. I have several projects that work that way and compile fine.
What is the problem specifically and what error messages are you getting?
-
January 8th, 2009, 10:20 AM
#10
Re: link external obj files in vs 2005
Thanks GCDEF, I did follow what you said yesterday and added them as if they are cpp files. I could not find my old thread today so just started a new one, sorry that im new here.
Basically after adding those obj files, I only made a main function like this, to test if those obj files are linked:
int main()
{
return 1;
}
When adding the obj files, they did asked me saying the building rules are not defined. I just hit cancel as I was not sure what to do there -_-
Here are some of the error messages I got:
Once again thanks for your help and sorry was messing up the threads earlier.
Error 1 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRTD.lib
Error 2 error LNK2005: "private: class type_info & __thiscall type_info:perator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRTD.lib
Error 4 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) TickCharacters.obj
Error 5 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) UpdateCharacters.obj
Error 6 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) work.obj
-
January 8th, 2009, 10:30 AM
#11
Re: link external obj files in vs 2005
Originally Posted by lqakane
When adding the obj files, they did asked me saying the building rules are not defined. I just hit cancel as I was not sure what to do there -_-
Here are some of the error messages I got:
Let's start from step 1.
First, an object file is an intermediate file created by the compiler. Given that, these object files were created using certain compiler options, i.e. debug, release, optimizations, etc.
This means that you can't just "drop-in" object files into a project without full information on how those object files were compiled.
What compiler was used to compile these object files? What version of the compiler was used? What compiler options? Were these object files created using the static or DLL version of the runtime? etc. etc.
Whatever those answers are, that is what your main application must be compiled with. Otherwise, you're taking object files created one way, and trying to apply it to an application created another way. That, in general, is what those errors are telling you.
Regards,
Paul McKenzie
-
January 8th, 2009, 10:39 AM
#12
Re: link external obj files in vs 2005
Originally Posted by Paul McKenzie
Let's start from step 1.
First, an object file is an intermediate file created by the compiler. Given that, these object files were created using certain compiler options, i.e. debug, release, optimizations, etc.
This means that you can't just "drop-in" object files into a project without full information on how those object files were compiled.
What compiler was used to compile these object files? What version of the compiler was used? What compiler options? Were these object files created using the static or DLL version of the runtime? etc. etc.
Whatever those answers are, that is what your main application must be compiled with. Otherwise, you're taking object files created one way, and trying to apply it to an application created another way. That, in general, is what those errors are telling you.
Regards,
Paul McKenzie
Read the errors again. They're unresolved external and already defined errors.
-
January 8th, 2009, 11:41 AM
#13
Re: link external obj files in vs 2005
Originally Posted by GCDEF
Read the errors again. They're unresolved external and already defined errors.
I gave a general reason of why errors would show up when linking object files, and what to make sure of before going on any further.
Regardless of what the resolution is, the options used to create the object files must be known by the person using them, so as to minimize any problems.
Regards,
Paul McKenzie
-
January 8th, 2009, 10:44 AM
#14
Re: link external obj files in vs 2005
Originally Posted by lqakane
Thanks GCDEF, I did follow what you said yesterday and added them as if they are cpp files. I could not find my old thread today so just started a new one, sorry that im new here.
Basically after adding those obj files, I only made a main function like this, to test if those obj files are linked:
int main()
{
return 1;
}
When adding the obj files, they did asked me saying the building rules are not defined. I just hit cancel as I was not sure what to do there -_-
Here are some of the error messages I got:
Once again thanks for your help and sorry was messing up the threads earlier.
Error 1 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRTD.lib
Error 2 error LNK2005: "private: class type_info & __thiscall type_info: perator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRTD.lib
Error 4 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) TickCharacters.obj
Error 5 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) UpdateCharacters.obj
Error 6 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) work.obj
In your project settings, add LIBCMT to the Ignore Specific Library section of your linker input options.
Looks like there's some kind of function call Xran that the linker doesn't know about. Did you add all the files you're supposed to?
-
January 8th, 2009, 11:24 AM
#15
Re: link external obj files in vs 2005
Originally Posted by GCDEF
In your project settings, add LIBCMT to the Ignore Specific Library section of your linker input options.
Looks like there's some kind of function call Xran that the linker doesn't know about. Did you add all the files you're supposed to?
I typed LIBCMT in the field of "Ignore Specific Library" under Linker->Input...hope im doing right.
There are all together 62 errors. About 20 of them are complaining Xran function and 20 of them complains about Xlen like this:
Error 28 error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) TickCharacters.obj
and the rest are like this:
Error 57 error LNK2001: unresolved external symbol "public: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@QAEXXZ) NewGame.obj
I think I included all the obj files. Together with the obj files they also gave me several cpp and h files. Initially I tried adding them and build, which gave me lots of compile errors so I decided starting from a simple main(). I checked with those cpp/h files and none of them contains the functions the linking errors are complaining about...
Many thanks!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|