Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: awsdert on April 01, 2014, 07:21:34 pm

Title: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 07:21:34 pm
I know I'm not supposed to post linkage stuff but I think mine is being caused by a setting in my project and I'm clueless to what is causing it, could someone help me identify the setting and explain what went wrong, I'm presuming the attachment and the below should be all you need but let me know if you need more or if this is not a setting problem. BTW my MSVS version is 2013 I simply modified the MSVS 2010 settings to use that instead.
Code
-------------- Clean: libzxs-x64-d-vc in libzxs (compiler: Microsoft Visual C++ 2010)---------------

Cleaned "libzxs - libzxs-x64-d-vc"

-------------- Build: libzxs-x64-d-vc in libzxs (compiler: Microsoft Visual C++ 2010)---------------

cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c libzxs.c /Foobj\libzxs-x64-d-vc\libzxs.obj
libzxs.c
cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c main.c /Foobj\libzxs-x64-d-vc\main.obj
main.c
cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c src\dirent.c /Foobj\libzxs-x64-d-vc\src\dirent.obj
dirent.c
cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c src\zxs\acs.c /Foobj\libzxs-x64-d-vc\src\zxs\acs.obj
acs.c
cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c src\zxs\fso.c /Foobj\libzxs-x64-d-vc\src\zxs\fso.obj
fso.c
cl.exe /nologo -DDIRECTINPUT_VERSION=0x0800 -DZX__BUILD  /Zi /D_DEBUG /D_AMD64_ /D_WIN64  /D_USING_V110_SDK71_   /Iinclude /IC:\sdk\MSDX-2010-06\include /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include" /IC:\p\MSVS-x86\VC\include /c src\zxs\wcs.c /Foobj\libzxs-x64-d-vc\src\zxs\wcs.obj
wcs.c
link.exe /nologo /LIBPATH:C:\sdk\MSDX-2010-06\lib\x64 /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\lib\x64" /LIBPATH:C:\p\MSVS-x86\VC\lib\amd64 /out:bin\libzxs-x64-d-vc.exe kernel32.lib gdi32.lib dxguid.lib dinput8.lib user32.lib ComCtl32.lib obj\libzxs-x64-d-vc\libzxs.obj obj\libzxs-x64-d-vc\main.obj obj\libzxs-x64-d-vc\src\dirent.obj obj\libzxs-x64-d-vc\src\zxs\acs.obj obj\libzxs-x64-d-vc\src\zxs\fso.obj obj\libzxs-x64-d-vc\src\zxs\wcs.obj  /DEBUG /machine:x64
obj\libzxs-x64-d-vc\libzxs.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
Process terminated with status 1112 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 07:45:22 pm
Learn about your compiler!
Decide if you are doing 32 bit or 64 bit?


Then, do the right thing for that decision.

Link to the main option that should be set based on your  decision. http://msdn.microsoft.com/en-us/library/5wy54dk2.aspx (http://msdn.microsoft.com/en-us/library/5wy54dk2.aspx)

Edit2: I do NOT normally use MSVC; I found the above info in 15 minutes using Google.

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 08:03:04 pm
Did you think I hadn't already tried that?
It ignored the /env and treated the x64 as a file, and I already have /MACHINE:X64 in the linker options.
Please at least look at the project file before you reply, I do not appreciate being treated like an idiot.

Edit: On another note you should have seen in the output that I have actually looked into those compiler settings which is making me think you're not worth listening to. If you are just gonna be lazy about it then don't bother I'd rather have replies from someone who is actually gonna try to help.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 08:12:35 pm
Code
/IC:\p\MSVS-x86\VC\include

And, please stop and think You are compiling x86 stuff and trying to link x64 bit stuff.
Please learn to read!!!!!!!!!!!

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 08:18:33 pm
if you can find a 64bit visual studio then please post a link otherwise go bug someone else as you clearly do not understand what you are talking about.

Edit: BTW with header files it does NOT matter about the path but rather what code is placed in those headers (which BTW is all TEXT to be compiled)
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 08:20:34 pm
if you can find a 64bit visual studio then please post a link otherwise go bug someone else as you clearly do not understand what you are talking about.

I am going to ask you be banned for violating the rules.
Edit: Decided to let someone else ask you to be banned for violating the rules http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)
Changed my mind; you really need to read the rules!

Bye

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 08:23:27 pm
I have just reported you as a troll since you do not actually understand a thing in this thread
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 08:26:59 pm
I have just reported you as a troll since you do not actually understand a thing in this thread

I do understand you ARE not asking a CB question; but, a compiler question.
You are likely to be banned.

http://www.catb.org/esr/faqs/smart-questions.html (http://www.catb.org/esr/faqs/smart-questions.html)

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 08:30:32 pm
This is a CONFIGURATION question, if you re-read the post then you will understand WHY I have posted it here in the first place.
I HAVE read those rules and still posted here BECAUSE I believe something is wrong with the *.CBP file, if you cannot understand that then keep OUT of this thread.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 08:35:53 pm
This is a CONFIGURATION question, if you re-read the post then you will understand WHY I have posted it here in the first place.
I HAVE read those rules and still posted here BECAUSE I believe something is wrong with the *.CBP file, if you cannot understand that then keep OUT of this thread.

What option are you trying to add!!!!!!!

If you state an option and ask how to add it it is a CB question.
If you have no idea what Compiler/Linker option it is off topic.

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 08:54:09 pm
I have tried all the easy to find linker stuff and compiler stuff, I have also set the compiler search to directories to locate only 64bit libs so the only thing I can think of is that it is has something to do with individual file settings in the project file as some files compile fine while others don't even though they should all have the SAME settings as I removed all the extra that CB put in to ensure it sticks to just the target settings. Please at least look at the output and the project file so that you SEE that I have done all I can before posting this here.

As a side note all my code is done in just ANSI C so it should not be a compiler problem and based off of the documentation MS provides the /machine:x64 was the only additional option I had to set for VC2013 to understand that it should be using 64bit based code. If you haven't already noticed no other file before it produces that issue even though they rely on the same target settings hence why I think this is a cfg issue.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 09:00:31 pm
Read this link do try to fix your CB configuration!
http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c22a0e1-ceec-4092-b642-e3743bfa47cd/command-line-for-x64-bit-compilation?forum=vclanguage (http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c22a0e1-ceec-4092-b642-e3743bfa47cd/command-line-for-x64-bit-compilation?forum=vclanguage)

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 09:17:57 pm
Thank you that was much more helpful, solved my problem although it would've been sufficient for you to say something like "There was no issue that I could find in the project cfg, see if the toolchain executables are actually able to compile 64bit code", that would have been enough instead of you having to research something outside of this forums (for lack of a better word) requirements.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 09:27:08 pm
Thank you that was much more helpful, solved my problem although it would've been sufficient for you to say something like "There was no issue that I could find in the project cfg, see if the toolchain executables are actually able to compile 64bit code", that would have been enough instead of you having to research something outside of this forums (for lack of a better word) requirements.

WE DO NOT SUPPORT THE MSVC COMPILER!!!!!!!!!!!!!!
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 09:36:20 pm
That's why I said it would have been sufficient to say "There was no issue that I could find in the project cfg, see if the toolchain executables are actually able to compile 64bit code", I did not ask you to solve the problem if it was not a cfg issue but rather check to see if it was a cfg issue or just me missing something in the documentation. I never expected you to research any compiler or linker stuff just to check whether something in xml was causing my problem, if you found an issue there then that's all I expected you to help me with. Anything further, while nice, was not within my expectations.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 01, 2014, 09:48:26 pm
That's why I said it would have been sufficient to say "There was no issue that I could find in the project cfg, see if the toolchain executables are actually able to compile 64bit code", I did not ask you to solve the problem if it was not a cfg issue but rather check to see if it was a cfg issue or just me missing something in the documentation. I never expected you to research any compiler or linker stuff just to check whether something in xml was causing my problem, if you found an issue there then that's all I expected you to help me with. Anything further, while nice, was not within my expectations.

YOU ARE ON THE INTERNET! LEARN TO USE GOOGLE! LEARN TO ASK SMART QUESTIONS! LEARN TO THINK!

Tim S.
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 01, 2014, 09:59:19 pm
If you think I didn't use google then you should've just ignored my post, and just so you are aware I do know how to use google and how to think (wouldn't be programming if I didn't), I'm just human not a robot like you seem to be mr I'm so perfect. It seems to me that it's you who doesn't think at all and as such in future I will ignore your posts when I notice they are from you goodbye.
Title: Re: Linker target messsed up on single file
Post by: stahta01 on April 02, 2014, 05:10:16 pm
If you think I didn't use google then you should've just ignored my post, and just so you are aware I do know how to use google and how to think (wouldn't be programming if I didn't), I'm just human not a robot like you seem to be mr I'm so perfect. It seems to me that it's you who doesn't think at all and as such in future I will ignore your posts when I notice they are from you goodbye.

I found the post using Google you idiot!@!!!!!!!!!!

Tim S.
Title: Re: Linker target messsed up on single file
Post by: ollydbg on April 02, 2014, 05:20:19 pm
@ awsdert
From your original post, I see some linker errors, and you try to solve those linker errors. But that is not a C::B question right I can see.

If you think it is a C::B question, then you can show us what is the correct linker command C::B should execute.
Title: Re: Linker target messsed up on single file
Post by: oBFusCATed on April 02, 2014, 06:10:16 pm
@stahta01: You're a bit more aggressive than needed...

@awsdert:
I'm not sure if VC compilers in C::B are setup to generate 64bit code by default.
If I were you I'd try to build a hello world project in 32bit mode first, to verify the 32bit version works.
Then I'll try to build in 64bit the same project.
Also I'd try to build on the command line. The VC compiler provide batch scripts which setups the environment correctly for both 32 and 64 bits.
Use them and inspect the environment variables with executing "set".
Also I'll search the wiki for info about VC, because the setup is not simple...

Good luck...
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 04, 2014, 11:28:44 pm
Just remembered about this thread :P
Since stahta01 has a short fuse I'm going to refer to him as shorty from now on.

@oBFusCATed & @ollydbg
Like I said the post shorty :D provided actually helped solve the problem (although I will admit I was not expecting anyone here to go as far as doing their own research on the compiler), the original reason I believed it was a CB cfg problem was because it was an individual file from my project was not compiling even though the rest were doing just fine, after shorty's post I looked into VC's \bin directory and found that I had made a misunderstanding about the compiler thinking that like gcc (that being the only other compiler I have experience with) it used only one executable for generating code, after cloning the compiler profile and setting it up for x64 bit directories everything went smoothly (aside from my own programming mistakes obviously). Shorty just got the wrong end of the stick and thought I wanted people to check the linker options, I only wanted people to check the xml side of things and make sure none of that was the cause of my problem, it was just happy coincidence that he found what I could not.

Edit: Missed a word :P
Title: Re: Linker target messsed up on single file
Post by: Jenna on April 04, 2014, 11:35:43 pm
Just remembered about this thread :P
Since stahta01 has a short fuse I'm going to refer to him as shorty from now on.

If you do not calm down and stop being agressive, you get banned for a while.

No matter what has happened so far, there is no reason to inflame the conflict!
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 05, 2014, 09:36:38 am
Erm... where do you see aggression? It's normal to give people nicknames related to their personality so that can't be it, but then I can't see anything else you would mis-interpret as aggression sooo ???
Title: Re: Linker target messsed up on single file
Post by: Jenna on April 05, 2014, 10:06:37 am
Erm... where do you see aggression? It's normal to give people nicknames related to their personality so that can't be it, but then I can't see anything else you would mis-interpret as aggression sooo ???

Do you rally want to start a discussion ?

Please do not waste my/our time with it.

Just calm down, don't use degrading nicknames for other users, learn to ask questions in a way others can understand you or leve the forum !

Last warning !!
Title: Re: Linker target messsed up on single file
Post by: awsdert on April 05, 2014, 04:22:38 pm
Seems to me your the one who needs to calm down, and what's degrading about referring to his short fuse? Last I checked referring to facts is NOT aggressive in any way. Whatever I'm ignoring his posts now anyways so I shouldn't have to refer to him in future.
Title: Re: Linker target messsed up on single file
Post by: Jenna on April 05, 2014, 04:28:24 pm
Seems to me your the one who needs to calm down, and what's degrading about referring to his short fuse? Last I checked referring to facts is NOT aggressive in any way. Whatever I'm ignoring his posts now anyways so I shouldn't have to refer to him in future.
I just locked this topic and banned you (partially) for 6 days.