Fatal error lnk1113 invalid machine type

While building the project in VS2012, I'm getting the linking error as LNK1113: invalid machine type 0x1C0 I'm not sure where to check and what would be the error. Any help would be appreciated.

While building the project in VS2012, I’m getting the linking error as

LNK1113: invalid machine type 0x1C0

I’m not sure where to check and what would be the error. Any help would be appreciated.

Thanks

asked Jul 28, 2015 at 19:42

Matt's user avatar

3

two minutes google for ‘how to set module machine type in visual studio’

resulted in the following info, found at:

<http://stackoverflow.com/questions/3563756/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ>



Check your properties options in your linker settings at: 
Properties > Configuration Properties > Linker > Advanced > Target Machine. 
Select MachineX64 if you are targeting a 64 bit build, 
or MachineX86 if you are making a 32 bit build.

Select Build > Configuration Manager 
from the main menu in visual studio. 
Make sure your project has the correct platform specified. 
It is possible for the IDE to be set to build x64 
but an individual project in the solution can be set to target win32. 
So yeah, visual studio leaves a lot of rope to hang yourself, 
but that's life.

Check your library files 
that they really are of the type of platform are targeting. 
This can be used by using dumpbin.exe 
which is in your visual studio VCbin directory.
use the -headers option to dump all your functions. 
Look for the machine entry for each function. 
it should include x64 if it's a 64 bit build.

In visual studio, select 
Tools > Options from the main menu. 
select Projects and Solutions > VC++ Directories. 
Select x64 from the Platform dropdown. 
Make sure that the first entry is: 
$(VCInstallDir)binx86_amd64 
followed by $(VCInstallDir)bin.

Once I did step 4 everything worked again for me. 
The thing was I was encountering this problem on all my projects 
where I wanted to compile towards a 64 bit target. 

answered Jul 28, 2015 at 19:53

user3629249's user avatar

user3629249user3629249

16.3k1 gold badge19 silver badges17 bronze badges

Содержание

  1. Fatal error lnk1113 invalid machine type
  2. Answered by:
  3. Question
  4. Answers
  5. Fatal error lnk1113 invalid machine type
  6. Answered by:
  7. Question
  8. Answers
  9. Fatal error lnk1113 invalid machine type
  10. Answered by:
  11. Question
  12. Answers
  13. Fatal error lnk1113 invalid machine type
  14. Fatal error lnk1113 invalid machine type
  15. Лучший отвечающий
  16. Вопрос
  17. Ответы

Fatal error lnk1113 invalid machine type

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Has anyone ever seen this error, because this one is above me . . I have no idea what wrong is, could someone please help.

Thanx in advance

Answers

Please note that all major compilers are Cross-Compilers. They can build code for some other (not all) processors different than what they are running on. In our Project Build Settings where we pass parameters to our compiler executable, we also pass the target-platform in form of a macro . etc. ex :

somecompiler.exe filname.cc -DX86

somecompiler.exe filname.cc -DARM

So if ur program executable is ported from some othe architecture it needs to be Recompiled. BY DOING THIS U DON’T CHANGE THE CPP files. BUT U CHANGE THE BINARY INSTRUCTIONS THAT UR COMPILER GENERATES FOR U FOR A SPECIFIC PROCESSOR USING UR CPP FILES.

Please note that in Windows Architecture Independence is at HAL and NOT at compiler level.U have to recompile ur application whenever u change the hardware architecture. (normally not while upgrade. Intel processors have amazing backward compatibility. But please verify if u have linked to correct 64-bit LIBs, if at al u r compiling for 64 bit platform).

This was an observation to ur response to Martin’s answer.

Источник

Fatal error lnk1113 invalid machine type

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Has anyone ever seen this error, because this one is above me . . I have no idea what wrong is, could someone please help.

Thanx in advance

Answers

Please note that all major compilers are Cross-Compilers. They can build code for some other (not all) processors different than what they are running on. In our Project Build Settings where we pass parameters to our compiler executable, we also pass the target-platform in form of a macro . etc. ex :

somecompiler.exe filname.cc -DX86

somecompiler.exe filname.cc -DARM

So if ur program executable is ported from some othe architecture it needs to be Recompiled. BY DOING THIS U DON’T CHANGE THE CPP files. BUT U CHANGE THE BINARY INSTRUCTIONS THAT UR COMPILER GENERATES FOR U FOR A SPECIFIC PROCESSOR USING UR CPP FILES.

Please note that in Windows Architecture Independence is at HAL and NOT at compiler level.U have to recompile ur application whenever u change the hardware architecture. (normally not while upgrade. Intel processors have amazing backward compatibility. But please verify if u have linked to correct 64-bit LIBs, if at al u r compiling for 64 bit platform).

This was an observation to ur response to Martin’s answer.

Источник

Fatal error lnk1113 invalid machine type

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Has anyone ever seen this error, because this one is above me . . I have no idea what wrong is, could someone please help.

Thanx in advance

Answers

Please note that all major compilers are Cross-Compilers. They can build code for some other (not all) processors different than what they are running on. In our Project Build Settings where we pass parameters to our compiler executable, we also pass the target-platform in form of a macro . etc. ex :

somecompiler.exe filname.cc -DX86

somecompiler.exe filname.cc -DARM

So if ur program executable is ported from some othe architecture it needs to be Recompiled. BY DOING THIS U DON’T CHANGE THE CPP files. BUT U CHANGE THE BINARY INSTRUCTIONS THAT UR COMPILER GENERATES FOR U FOR A SPECIFIC PROCESSOR USING UR CPP FILES.

Please note that in Windows Architecture Independence is at HAL and NOT at compiler level.U have to recompile ur application whenever u change the hardware architecture. (normally not while upgrade. Intel processors have amazing backward compatibility. But please verify if u have linked to correct 64-bit LIBs, if at al u r compiling for 64 bit platform).

This was an observation to ur response to Martin’s answer.

Источник

Fatal error lnk1113 invalid machine type

Когда поставил SDK_2007_november и MS Visual C++ 6.0, то сразу же столкнулся с такой проблемой:
указал include`s с установленногго СДК, а либы-более новые скачал с инета, все подключил, результат—многие примеры работают, даже пример ParallaxMapping тоже работает именно с этой конфигурацией инклюдов и либов моих (инклюды-стандартные, а либы-скаченные)
но другие примеры требуют другой такой конфигурации,я их меняю, пока пример неоткомпилируется. а когда я ворачиваюсь к Параллаксу или любому другому примеру, естественно выставляю либы и инклюды все на место (на первое место стрелкой вверх=))), то происходят разного рода ошибки:
+++++++++++++++++++++++++++++++++++++++++
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/trial.exe : fatal error LNK1120: 1 unresolved externals

:PROGRAM FILESMICROSOFT DIRECTX SDK (NOVEMBER 2007)LIBX64d3d9.lib : fatal error LNK1113: invalid machine type
Error executing link.exe.

trial.obj : error LNK2001: unresolved external symbol [email protected]
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/trial.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

объясните пожалуйсто, как этого избежать ? я понимаю, что он пишет, что неизвестные функции и т.п., но иногда же работает ! мне приходится каждый раз удалять пример, доставать его целого-и невридимого из архива, распаковывать и снова компилировать, но если я прибегну к другому примеру и обратно к нему. то все !
и таких глюков с компилятором моим, ну ооочень много! или мне просто снести С++6.0 и поставить нормальный, новый Восьмой ?

Источник

Fatal error lnk1113 invalid machine type

Лучший отвечающий

Вопрос

Has anyone ever seen this error, because this one is above me . . I have no idea what wrong is, could someone please help.

Thanx in advance

Ответы

Please note that all major compilers are Cross-Compilers. They can build code for some other (not all) processors different than what they are running on. In our Project Build Settings where we pass parameters to our compiler executable, we also pass the target-platform in form of a macro . etc. ex :

somecompiler.exe filname.cc -DX86

somecompiler.exe filname.cc -DARM

So if ur program executable is ported from some othe architecture it needs to be Recompiled. BY DOING THIS U DON’T CHANGE THE CPP files. BUT U CHANGE THE BINARY INSTRUCTIONS THAT UR COMPILER GENERATES FOR U FOR A SPECIFIC PROCESSOR USING UR CPP FILES.

Please note that in Windows Architecture Independence is at HAL and NOT at compiler level.U have to recompile ur application whenever u change the hardware architecture. (normally not while upgrade. Intel processors have amazing backward compatibility. But please verify if u have linked to correct 64-bit LIBs, if at al u r compiling for 64 bit platform).

This was an observation to ur response to Martin’s answer.

Источник

VC connectionMySQL’s configuration process is in the previous blog post, but when you set it well, when you don’t want to do things, you will have this error: libmysql.lib: Fatal Error LNK1113: Invalid Machinetype。 Invalid machine type, it is really very embarrassed.

The reason for this error is that I installed the 64bit mySQL server on Win8.1, and I compiled 32-bit VC programs, which is connected to the 64-bit libmysql.lib library, so I will generate «invalid machine type ( Invalid Machine Type «» error prompt.

For this «Error LNK1113» error solution is:

Download 32-bit MySQL ZIP packets, about more than 100 M. Unzip it, locate the lib directory according to step 4. In this case, when our 32-bit programs are compiled, the link is a 32-bit library, and there will be no above link error. It is also necessary to change to the XP system.

Environmental description:

Operating system: Windows 8.1

Development Tool: VC ++ 6.0

Developed EXE: 32-bit programs

Database Server: 64-bit MySQL-5.5

The referenced database lib: 32-bit mysql-5.7.10-WIN32.ZIP (320M) LIB folder.

Proceed as follows:

1.  Go to the official website www.mysql.com to download the mysql installation package:

Mysql-5.7.10-win32.zip address:http://dev.mysql.com/downloads/mysql/

Of course, you can also download mysql * .msi.

2.  Install mysql, such as (if it is .msi installation) during installationBe sure to select the C INCLUDE FILES / LIB FILES, which can be found in the mysql installation folder after installation, which will be used below the following operations.

3. Copy the libmysql.dll under D: MySQL32 mysql-5.7.10-win32 lib and copy it to C: Windows System32. (I didn’t do this, I can compile it, I was verified under Win8.1, I don’t know if this step is needed in Win-NT).

4. This is also the most critical step!Open: Tools -> Options menu, find the «Directory» tabYou can see a drop-down box that: «Display Directory», select the library files option, add: [32-bit mysql zip decompressed folder] mysqlserver 5.7 lib , as shown:

   

I can see that I am this 32-bit lib.

5. If you put libmysql.lib,Libmysql.dll copied toIn the program directory, don’t forget to replace the original file with your 32-bit file.

6. Compile operation, success.

Just replace 64-bit libs with 32-bit libs, this, when our 32-bit programs are compiled, the link is 32-bit libraries, and there will be no such link error.

The solution is still very simple, that is, the download zip package is too slow. . . .

// test.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <windows.h>
#include "StdAfx.h"

#include <winsock.h>  
#include <iostream>  
#include <string>  
#include <mysql.h>  
using namespace std;  
//#pragma comment (lib,"ws2_32.lib")  
//#pragma comment(lib,"libmysql.lib")  
// Don't let go of yourself  
//#define STEPBYSTEP  
  
void pause(){  
  
    #ifdef STEPBYSTEP  
        system("pause");  
    #endif  
}  
void writeToFile(const char *s)  
{  
  
     FILE *fp=fopen("info.txt","rw");  
     fprintf(fp,s);  
     fclose(fp);  
  
}  
 /* int main()

{

       MYSQL mysql;
               mysql_init (& mysql); // Initialize the MySQL structure

       if(!mysql_real_connect(&mysql,"localhost","myuser","123456","student_db",3306,NULL,0))
                             Printf (" n incorrectly in the database!  n");
       else
                             Printf (" n connection database success!  n");

               MySQL_Close (& mysql); // Release Database
  
       return 0;
}*/
int main(int argc, char* argv[]){  
  
    cout<<"start...."<<endl;  
    pause();  
    MYSQL mysql;  
    if(0==mysql_library_init(0,NULL,NULL))  
    {  
        cout<<"mysql_library_init succeed"<<endl;  
  
    }else{  
        cout<<"mysql_library_init failed"<<endl;  
        return -1;  
    }  
    pause();  
    if(NULL!=mysql_init(&mysql))  
    {  
  
        cout<<"mysql_init succeed"<<endl;  
    }else{  
        cout<<"mysql_init failed"<<endl;  
        return -1;  
    }  
    pause();  
    if(0==mysql_options(&mysql,MYSQL_SET_CHARSET_NAME,"gb2312"))  
    {  
  
        cout<<"mysql_option succeed"<<endl;  
    }else{  
        cout<<"mysql_option failed"<<endl;  
        return -1;  
    }  
    pause();  
  
    if(NULL!=mysql_real_connect(&mysql,"localhost","myuser","123456","student_db",3306,NULL,0))  
    {  
  
        cout<<"mysql_real_connect succeed"<<endl;  
    }else{  
        cout<<"mysql_real_connect failed"<<endl;  
        return -1;  
    }  
    pause();  
    string sql;  
    
    sql="select * from sgroup";  
    MYSQL_RES *result=NULL;  
    if(0==mysql_query(&mysql,sql.c_str()))  
    {  
  
            cout<<"mysql_query select succeed"<<endl;  
            result=mysql_store_result(&mysql);  
            int rowcount=mysql_num_rows(result);  
            cout<<"row count:"<<rowcount<<endl;  
            unsigned int fieldcount=mysql_num_fields(result);  
            MYSQL_FIELD *field=NULL;  
            for(unsigned int i=0;i<fieldcount;i++)  
            {  
  
                field=mysql_fetch_field_direct(result,i);  
                cout<<field->name<<"tt";  
            }  
            cout<<endl;  
            MYSQL_ROW row=NULL;  
            row=mysql_fetch_row(result);  
            while(NULL!=row)  
            {  
  
                for(int i=0;i<fieldcount;i++){  
  
                    cout<<row[i]<<"tt";  
  
                }  
                cout<<endl;  
                row=mysql_fetch_row(result);  
  
            }  
    }else{  
  
            cout<<"mysql_query select data failed"<<endl;  
            mysql_close(&mysql);  
            return -1;  
    }  
    pause();  
    /*sql="drop table user_info";  
    if(0==mysql_query(&mysql,sql.c_str()))  
    {  
  
            cout<<"mysql_query drop table succeed"<<endl;  
    }else{  
            cout<<"mysql_query drop table failed"<<endl;  
            mysql_close(&mysql);  
            return -1;  
  
    }  */
    mysql_free_result(result);  
    mysql_close(&mysql);  
    mysql_server_end();  
  
  
    system("pause");  
    return 0;  
} 

  

According to what you show, your failure occured on a 64-bit Windows installation. It’s difficult to persuade CVF (even in the final version) to install on such a system, and it seems unlikely that CFX supports a combination of a very old version of CVF with a recent Windows X64. As this is a commercial licensed application, it seems more appropriate to assure that you have current rights to use it, and to follow the vendor’s recommendations.

Thanks tim18, for the reply.

The point is, the compilation works flawlessly on one 64-bit machine and doesnot work on another 64-bit machine with the same configuration. Is there anyway to verify if there is a difference in architecture?

I have the current rights for both the programs. I am in touch with CFX support, but at the architecture level I find it more appropriate to use this forum.

I am at loss in undestanding why the same compiler would behave differently on two machines with the same architecture.

I have also been trying the following things:

1. I tried using the update ‘Compaq Visual Fortran 6.6 — Intel Version’, and it gives the same error.

«A fatal error has occured in cfx5mkext:

Essential (non-synthesisable) configuration parameter fc («/OS:winnt amd64/fc») missing from configuration file cfx5mkext.ccl»

2. I tried changing the ‘OS’ in cfx5mkext.ccl file from ‘OS: winnt’ to ‘OS: winnt amd64’. Now, the previous error disappears and I get a new error. This makes me believe that the architecture is not exactly the same (any ideas on how to confirm if the architecture is exactly the same the way the compiler recognises it?). Anyways, the new error I now obtain is (attached in compile.jpeg):

‘solver-mpich2.lib: fatal error LNK1113: invalid machine type

An error has occured in cfx5mkext:

df exited with return code 89.

(more explicitly in ‘compile.jpeg’ attached)

It sounds like this is due the machine architecture but it works on another machine with the same (I believe) architecture.

On the machine where the problem doesn’t occur, it looks like (attached Noproblem-compile-2.jpg) the one shown below and

the .dll file is created as anticipated:

Any pointers would be greatly appreciated.

Thanks,

Sai.


Recommended Answers

Do you have a 64-bit machine?

Have you tried to restart Visual Studio and build again your solution?

Also, I know that a «Clean Solution / Rebuild Solution» solves a lot of problems.

You can click on the error message and press F1. If you’re lucky, that …

Jump to Post

Maybe you have a specific setting, a flag or something. Check this page:

http://social.microsoft.com/Forums/en-US/vcgeneral/thread/d2677732-d756-42e5-b2f1-5b040819c037

Don’t forget that a re-install may solve the problem.

Jump to Post

If you’re using Windows Vista, it might be a better idea to use one of Microsoft’s free available Express Editions, otherwise reinstalling the application might fix the problem …

Jump to Post

All 10 Replies

Member Avatar

13 Years Ago

Do you have a 64-bit machine?

Have you tried to restart Visual Studio and build again your solution?

Also, I know that a «Clean Solution / Rebuild Solution» solves a lot of problems.

You can click on the error message and press F1. If you’re lucky, that will lead you to more info on the error. And also, Google is your friend!

Member Avatar

13 Years Ago

i tried but it wont work… i dont have 64-bit machine :(

Member Avatar

Member Avatar

13 Years Ago

If you’re using Windows Vista, it might be a better idea to use one of Microsoft’s free available Express Editions, otherwise reinstalling the application might fix the problem …

Member Avatar

Member Avatar

13 Years Ago

Srry, I forgot to post the link :)

Member Avatar

13 Years Ago

See this address for the express edition, I recommend it instead of VC++ 6.0:

http://www.microsoft.com/Express/

got it! thanks… now another problem… haha… sorry… hmmm why can i not build it? the icon for build is in gray and unclickable…

thanks again for the big help!

Member Avatar

13 Years Ago

Have you created a new project or have you just opened the file? Opening the file only prevents you from building the executable. You must create a project.

Member Avatar

13 Years Ago

Have you created a new project or have you just opened the file? Opening the file only prevents you from building the executable. You must create a project.

> That’s right !

Member Avatar

13 Years Ago

waaahhh…. i really dont understand the one you suggested me. I was trying to have a simple output for trial but it wont work….

#include <iostream.h>

void main()
{
	char name[20];

	cout << "what's your name? ";
	cin  >> name;

	cout << "thank you " << name;
}

then this is the result:

—— Build started: Project: tryanother, Configuration: Debug Win32 ——
Compiling…
sanamagwork.cpp
.sanamagwork.cpp(1) : fatal error C1083: Cannot open include file: ‘iostream.h’: No such file or directory
Build log was saved at «file://c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2008ProjectstryanotherDebugBuildLog.htm»
tryanother — 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Reply to this topic

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.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error lnk1104 не удается открыть файл vcompd lib
  • Fatal error lnk1104 не удается открыть файл msvcrtd lib
  • Fatal error lnk1104 не удается открыть файл kernel32 lib
  • Fatal error lnk1104 не удается открыть файл glut32 lib
  • Fatal error lnk1104 не удается открыть файл dll

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии