User forums > Using Code::Blocks

.obj to .exe using CodeBlocks

(1/3) > >>

finston:
I am trying to rework some older code for Windows Vista and 7 (and other platforms as possible). I have almost all the source code (C and C++) but my developer did not make it clear which code was used to compile and link to make the 32 bit executable which I have.

I have been able to use Resource Hacker on my existing 32 bit executable to introduce a new company logo and release date and will make this into a self extracting executable using iexpress, nsis or Self extracting Archive utility 16.0 So far so good.

However, I would like to get a fuller understanding of my programme and ideally take it to other platforms including symbian and wonderware.

By using IDA pro on the .obj files that I have, I have been able to obtain a list of all the elements of source, INC and RC files used in the original compilation. However I am missing four out of thirty six referenced files. This means I may not be able to recompile and link - I have not tried to as yet.

I thought that another way of making progress would be with the 32 bit .obj and .res files which I have. (I also have a .ide file).Is there a way of using CodeBlocks to purely link the existing .obj and .res files.

I created a project and added the existing files. The .res file came up under Resources and I noticed that it was greyed out. The nine .obj files (and one .tr2 and one .td2 file) appeared under Others, again greyed out. CodeBlocks appears to need priming in the linker settings and search directories. I have used linker settings of:

C:\Programme Files\CodeBlocks\minGW\lib\libopengl32.a
libkernel32.a
libgdi32.a
libuser32.a


Search Directories of:

Compiler: the setting for my INC folder

Linker: as above i.e.
C:\Programme Files\CodeBlocks\minGW\lib\libopengl32.a
libkernel32.a
libgdi32.a
libuser32.a

Resource Compiler: the setting of my RC folder


On Build I am getting

"mingw32-g++.exe -Wall  -g    -IC:\2011sip\USR\BC\INC -IC:\2011sip\USR\BC\INC  -c "C:\Documents and Settings\Dave\My Documents\2011sip\SIP\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -L"C:\Programme Files\CodeBlocks\MinGW\lib\libopengl32.a" -Llibkernel32.a -Llibgdi32.a -Llibuser32.a -L"C:\Programme Files\CodeBlocks\MinGW\lib\libopengl32.a" -Llibkernel32.a -Llibgdi32.a -Llibuser32.a  -o bin\Debug\SIP.exe obj\Debug\USR\BC\CWIN\OUT32\sipadv.res obj\Debug\main.o    -lgdi32 -luser32 -lkernel32 -lgdi32 "C:\Programme Files\CodeBlocks\MinGW\lib\libopengl32.a" -lkernel32 -lgdi32 -luser32
mingw32-g++.exe: obj\Debug\USR\BC\CWIN\OUT32\sipadv.res: No such file or directory
mingw32-g++.exe: C:\Programme Files\CodeBlocks\MinGW\lib\libopengl32.a: No such file or directory
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings
 

Am I using the wrong settings?

Is there a way to only link using CodeBlocks?

If so how?

Should I use a different linker?

If so what?


HELP, PLEASE - it seems so easy in theory


Finston in a pickle
   

stahta01:
Please write real questions after reading the FAQs
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_What_Code::Blocks_is_not.3F

Tim S.

finston:
Thanks fir the reply,tim

I am not going to try linking - point taken.

Can you comment on hoW I have set C::B up as per my last posting, please



Finston

stahta01:
Learn the difference between a path to the library (search directories) and the library name.

Libraries go under "Project" -> "Build Options" [Correct Target] Tab "Linker Settings" Sub-Tab "Link Libraries"

Path to Libraries go under go under "Project" -> "Build Options" [Correct Target] Tab "Search Directories" Sub-Tab "Linker"

Learn the basics of using a linker.
Go somewhere like cboard that teaches the basics of programming.

Learn to ask questions that have to do with Code::Blocks.

Read the Manuel and the Wiki pages
http://www.codeblocks.org/user-manual
http://wiki.codeblocks.org/index.php?title=FAQ

Tim S.

 

finston:
I have already looked at (and now revisited) both of the referenced links and taken on board what I can.

They do not make it clear that settings need to be input (I might have expected some resonable defaults), or what they should be and all that I have been able to find are odd snippets in forums of the settings of what worked for them.

Hence my reasonable question, in my opinion, as to whether I have entered the correct details (as per my original posting). I would still like an answer to this, but see below.

Having read your comments I have changed my Project settings as follows:

Your comment 1 "Libraries go under "Project" -> "Build Options" [Correct Target] Tab "Linker Settings" Sub-Tab "Link Libraries". Here, for both Debug and Release, I have placed the filename INC (which is where my .h, .rh files reside) and also RC (which is where my .rc .rh .dlg files reside)

Your comment 2 "Path to Libraries go under go under "Project" -> "Build Options" [Correct Target] Tab "Search Directories" Sub-Tab "Linker". Here, for both Debug and Release, I have put C:\sip2011\USR\BC\INC and C:\sip2011\USR\BC\RC which is where both INC and RC reside

Question: Do I need to put anything in "Project" -> "Build Options" [Correct Target] Tab "Search Directories" Sub-Tab "Compiler" or "resource compiler"


I have also put all the files which I belive consitute my project into the project under I have already looked at both of the referenced links and taken on board what I can.

They do not make it clear that settings need to be input (I might have expected some resonable defaults), or what they should be and all that I have been able to find are odd snippets in forums of the settings of what worked for them.

Hence my reasonable question, in my opinion, as to whether I have entered the correct details (as per my original posting). I would still like an answer to this, but see below.

Having read your comments I have changed my Project settings as follows:

Your comment 1 "Libraries go under "Project" -> "Build Options" [Correct Target] Tab "Linker Settings" Sub-Tab "Link Libraries". Here, for both Debug and Release, I have placed the filename INC (which is where my .h, .rh files reside) and also RC (which is where my .rc .rh .dlg files reside)

Your comment 2 "Path to Libraries go under go under "Project" -> "Build Options" [Correct Target] Tab "Search Directories" Sub-Tab "Linker". Here, for both Debug and Release, I have put C:\sip2011\USR\BC\INC and C:\sip2011\USR\BC\RC which is where both INC and RC reside

Note: I am uncertain of the above because I do not think my project files include any libraries

Question: Do I need to put anything in "Project" -> "Build Options" [Correct Target] Tab "Search Directories" Sub-Tab "Compiler" or "resource compiler"


I have put all my project files (as determined from my IDA Pro analysis of sip32.obj of my working sip32.exe) into the Project under Project-> Add files. However some of them are greyed out - what is this all about - no mention of it in the manual?



I am trying to recompile with Code::Blocks using the source code and .obj data that I have inherited without specifically being told which files were involved, so it is an uphill battle O.K.


Thanks replying, please keep helping me


Finston


I am trying to recompile with Code::Blocks using the source code and .obj data that I have inherited without specifically being told which files were involved, so it is an uphill battle O.K.


Thanks replying, please keep helping me


Finston

Navigation

[0] Message Index

[#] Next page

Go to full version