Q: I download any of the samples and try to build from VS?

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
Developer
Posts:37
Joined:Sun May 30, 2010 4:30 pm
Q: I download any of the samples and try to build from VS?

Post by Developer » Mon Aug 30, 2010 5:12 pm

Hi,

I hope Mike can answer this Q.

I have followed the tutorials and sample
steps, and I configured my VS2010 to
the "config" as suggested in the following
http://www.brokenthorn.com/Resources/OSDevMSVC.html.

However, it does NOT work as expected, very bad.

Some details, I have:
OS: Windows 7
IDE: Microsoft Visual Studio 2010
and then other tools.

Any help?

Thanks!

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Re: Q: I download any of the samples and try to build from VS?

Post by Mike » Wed Sep 01, 2010 1:10 pm

Hello,

It "should" work with one small additional change regarding UAC. The error will provide the information. If you are experiencing another issue please provide more information.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

Developer
Posts:37
Joined:Sun May 30, 2010 4:30 pm

Re: Q: I download any of the samples and try to build from VS?

Post by Developer » Mon Sep 06, 2010 8:47 am

Mike wrote:Hello,

It "should" work with one small additional change regarding UAC. The error will provide the information. If you are experiencing another issue please provide more information.
Hey Mike:

This is ONE OF the ERRORS:
======================================
Error 4 error LNK1295: '/DYNAMICBASE' not compatible with '/DRIVER' specification; link without '/DYNAMICBASE' A:\KRNL32.EXE Kernel
======================================

Warnings:
======================================
Warning 3 warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different attributes C:\Users\Developer\Desktop\Demo6\SysCore\Kernel\Lib.lib(cstd.obj) Kernel
======================================

Second Warning:
======================================
Warning 2 warning MSB8012: TargetName(Kernel) does not match the Linker's OutputFile property value (KRNL32). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 992 6 Kernel
======================================

Third warning:
======================================
Warning 1 warning MSB8012: TargetPath(C:\Users\Developer\Desktop\Demo6\SysCore\Debug\Kernel.exe) does not match the Linker's OutputFile property value (A:\KRNL32.EXE). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 990 6 Kernel
======================================

What to do and how to FIX?

BTW, regarding UAC I do NOT NEED TO WORRY SINCE IT IS TURNED OFF COMPLETELY IN MY PC :)

halofreak1990
Posts:92
Joined:Thu May 27, 2010 8:54 pm
Location:Netherlands

Re: Q: I download any of the samples and try to build from VS?

Post by halofreak1990 » Mon Sep 06, 2010 1:31 pm

Developer wrote:This is ONE OF the ERRORS:
======================================
Error 4 error LNK1295: '/DYNAMICBASE' not compatible with '/DRIVER' specification; link without '/DYNAMICBASE' A:\KRNL32.EXE Kernel
======================================
I'm not sure what difference the /DRIVER command makes during compiling, but turning either one of those commands off, should make it compile.
Developer wrote: Warnings:
======================================
Warning 3 warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different attributes C:\Users\Developer\Desktop\Demo6\SysCore\Kernel\Lib.lib(cstd.obj) Kernel
======================================
I get this one all the time, it's nothing to worry about.
Developer wrote: Second Warning:
======================================
Warning 2 warning MSB8012: TargetName(Kernel) does not match the Linker's OutputFile property value (KRNL32). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 992 6 Kernel
======================================

Third warning:
======================================
Warning 1 warning MSB8012: TargetPath(C:\Users\Developer\Desktop\Demo6\SysCore\Debug\Kernel.exe) does not match the Linker's OutputFile property value (A:\KRNL32.EXE). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 990 6 Kernel
======================================
This one could spell trouble, though, if the project compiles after fixing the error, this could be ignored.
However, just to be safe, could you post the Linker Options, and the --correct me if I'm wrong-- Code Generation Options

User avatar
Warsome
Posts:21
Joined:Sun Nov 18, 2007 3:13 am

Re: Q: I download any of the samples and try to build from VS?

Post by Warsome » Fri Nov 19, 2010 3:11 am

I have built the tutorials successfully under vs2010, these following steps will fix the errors and warnings given above and an explanation.

From MSDN:
One of the warnings you may see when upgrading you applications is MSB8012: $(TargetPath) and Linker’s OutputFile property value does not match:
- MSB8012: $(TargetExt) ('.dll') does not match the Linker's OutputFile property value 'C:\foo\Debug\MFCActiveX.ocx' ('.ocx') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetExt) property value matches the value specified in %(Link.OutputFile).
- MSB8012: $(TargetPath) ('C:\foo\Debug\MFCActiveX.dll') does not match the Linker's OutputFile property value 'C:\foo\Debug\MFCActiveX.ocx' ('C:\foo\Debug\MFCActiveX.ocx') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).
Link.OutputFile is the value defined at Linker -> General -> Output File on the property page. By default, its value is $(OutDir)$(TargetName)$(TargetExt), which is the same as the value of $(TargetPath). When we convert an application from a previous version, however, there is not an easy way for conversion to parse Link.OutputFile to figure out what exactly the values are for $(TargetName) and $(TargetExt), as different customers may have formatted them in different ways. To work around that, we decided to preserve the value of Linker.OutputFile during conversion. After conversion, $(TargetName) will default to $(ProjectName). $(TargetExt) will default to the default extension for the application type: .dll for Dynamic Library, .lib for Static Library and .exe for Application. Link.OutputFile value will be preserved. Warning MSB8012 will be issued in the conversion log if Link.OutputFile and $(TargetPath) are not the same. You will get the same warnings when building the application.
$(OutDir), $(TargetName) and $(TargetExt) are exposed on the "General" property page, as "Output Directory", "Target Name", "Target Extension", respectively. You can manually change the values of these properties so that you no longer get the warning.
-If your project produces Import Library (Linker -> Advanced -> Import Library), you may need to change the Output folder of the Import Library as well after conversion if the Linker output directory is not the default output directory. Otherwise, the generated import lib maybe in a different directory than the linker output.
-Debugging.Command is set to default $(TargetPath) after conversion. You may need to make changes so that the right executable will be launched upon F5 (Debugging) or Ctrl + F5 (Start without debugging).
SOLUTION:
Edit Entry Kernel Properties->Linker->General->Output File to equal $(OutDir)$(TargetName)$(TargetExt)

----------------------------------
/DRIVER errors

SOLUTION:
Delete Entry Kernel Properties->Linker->Advanced->Randomized Base Address
Delete Entry Kernel Properties->Linker->Advanced->Data Execution Prevention (DEP)

----------------------------------
Warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different attributes.

SOLUTION:
Edit Entry Kernel Properties->Linker->Command Line to equal /ALIGN:512 /ignore:4254

----------------------------------
If you have downloaded demo23 and you are getting build errors with the Fat12 project

SOLUTION:
Edit Entry Fat12 Properties->C/C++->General->Additional Include Directories to equal ../Kernel;../Include

From Michael

louki0101
Posts:1
Joined:Wed Jun 22, 2011 9:16 pm

Re: Q: I download any of the samples and try to build from VS?

Post by louki0101 » Wed Jun 22, 2011 9:18 pm

Is there a setup 2010 project floating around (Demo6 would be perfect)?

(sorry to sound lazy, the vs setup is just a super tricky thing to get "right")

These tutorials are GREAT by the way! by far the most "complete" series I've found online.

-Michael

Post Reply