Solved

Linker error Code generation failed in vc++ win32 application

Posted on 2008-06-26
11
4,201 Views
Last Modified: 2008-10-01
I have developed a glut and glui APPLICATION IN  vc++ win32 console application under windows vista......

My application was working fine.....I had used glpng library in my application to display png files...Later I replaced glpng with SOIL( simple open Image Library).. and also changed code according to that....suddenly my application is showing  the following linker error

LNK 1147 code generation failed......
any help would be greatly appreciated.......I tried to solve it from the morning......I could not solve it....
0
Comment
Question by:jsbsudha
  • 7
  • 3
11 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 21877525
Be sure to add "soil.lib" to your project to resolve th elinker errors. Either add a

#pragma comment(lib,"soil.lib")

to your code or add the lib via  "Project|Add exiting Item".
0
 

Author Comment

by:jsbsudha
ID: 21877591
I have added the library still i get the  same error
linker error--- code generation failed
fatal error C1900: Il mismatch between 'P1' version '20060201' and 'P2' version '20050411'
0
 
LVL 86

Expert Comment

by:jkr
ID: 21877623
What are 'P1' and 'P2' in the above?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:jsbsudha
ID: 21877641
I have to update anything in windows vista to solve this problem......It is not building the application......I have removed the glpng and glpngd library from additional dependencies...and added soil.lib.......
0
 

Author Comment

by:jsbsudha
ID: 21877649
I serached in msdn it is pass1 and pass2......I got this message in the ouput message window......surely it is not any variable
0
 

Author Comment

by:jsbsudha
ID: 21877659
It was working fine with glpng libraray .......but now it is not building
0
 
LVL 86

Expert Comment

by:jkr
ID: 21877661
Do you have more than one version of Visual Studio installed?
0
 

Author Comment

by:jsbsudha
ID: 21877671
NO...
0
 

Author Comment

by:jsbsudha
ID: 21877705
LNK 1257 and not lnk 1147
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 21888163
>>>> Linker Tools Error LNK1257 code generation failed

Actually that is only the final message after some other error(s) that were shown above in the output window.

>>>> Linker Tools Error LNK1147  invalid number specified with option 'option'

That is an error which comes if you were compiling newer sample code, e. g. for VC9 coming with VS2008 with an elder compiler (e. g. VC7.1 compiler coming with VS 2003). Then, one of the compiler options could not properly be handled as it was an option only supported by the newer compiler.

Please post all error messages of the output window, not only the final messages which actually doesn't say more than that compiling failed.


0
 

Author Comment

by:jsbsudha
ID: 21889732
I have solved the error in windows XP.....by having the correct version of  SOIL.lib in my program........I downloaded SOIL.lib from its website but I replaced it with another version of SOIL.lib library without my knowledge.......

THank you very much my error is solved...................
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now