Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: RobinMin on April 16, 2007, 05:46:22 pm

Title: Problem with simple test on Windows
Post by: RobinMin on April 16, 2007, 05:46:22 pm
After I installed C::B in my Windows XP, I used the wizard generate one project of console application for test C::B.
The code as following:
Code
#include <iostream>
using namespace std;

int main()
{
    CTest testor;

cout << "Hello world!" << endl;
return 0;
}


But, unfortunately ,I got the error message as following. I have no ideal with this ,anybody can give me any hint? Thank.
Code
LINK : fatal error LNK1181: cannot open input file 'Files\Microsoft.obj'

This is my enviroment:
1, OS : XP
2, C::B version (SVN 3858)
3, C++ compiler MSVC 2005

Title: Re: Problem with simple test on Windows
Post by: TDragon on April 16, 2007, 07:14:33 pm
This smells like a C::B bug, but the easiest fix for you right now would be to reinstall MSVC in a path without spaces (i.e. move it out of "Program Files"), and recreate your project in a path without spaces.
Title: Re: Problem with simple test on Windows
Post by: stahta01 on April 16, 2007, 08:02:10 pm
This smells like a C::B bug, but the easiest fix for you right now would be to reinstall MSVC in a path without spaces (i.e. move it out of "Program Files"), and recreate your project in a path without spaces.

It just worked OK for me.

This is my setup:
1, OS : XP SP2
2, C::B version (SVN 3859)
3, C++ compiler MSVC 2005 express edition
4, No spaces in my codeblock path.
5, No spaces in my project path.
6, My MSVC installed in standard "C:\Program Files\Microsoft Visual Studio 8"

Note: I had to comment out "CTest testor;" because it did NOT know what CTest was.

Tim S
Title: Re: Problem with simple test on Windows
Post by: Alturin on April 17, 2007, 12:34:18 am
I don't think it's the 'spaces inna path' bug, because that'd mean the path it passed originally was something like:
Code
C:/Program Files/Microsoft.obj
?
Would make more sense if there's some actual "Files/Microsoft.obj" directory somewhere in the default MSVC path when it's properly set?
Title: Re: Problem with simple test on Windows
Post by: stahta01 on April 17, 2007, 01:03:12 am
I don't think it's the 'spaces inna path' bug, because that'd mean the path it passed originally was something like:
Code
C:/Program Files/Microsoft.obj
?
Would make more sense if there's some actual "Files/Microsoft.obj" directory somewhere in the default MSVC path when it's properly set?

FYI: output with "compiler logging" turned to full.

"Setting" -> "Compiler and Debugger"
Select your compiler
Select "Other Settings"
Set "Compiler Logging" to "Full command Line"

Code
-------------- Build: Release in Test2 ---------------
cl.exe /nologo /W3 /EHsc /Ox /DNDEBUG /MD  /I"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include" /I"C:\Program Files\Microsoft Visual Studio 8\VC\include"  /c main.cpp /Foobj\Release\main.obj
main.cpp
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\lib"  /out:bin\Release\Test2.exe msvcrt.lib msvcprt.lib  obj\Release\main.obj   
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
Title: Re: Problem with simple test on Windows
Post by: RobinMin on April 17, 2007, 04:33:13 am
Oh,Thank you, stahta01. Your answer is very useful for me to see the cmd line ,:) .

But I got the following build log:
Code
-------------- Build: Debug in test001 ---------------
......
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\"  /out:bin\Debug\test001.exe  obj\Debug\main.obj   /DEBUG
LINK : fatal error LNK1181: cannot open input file 'Files\Microsoft.obj'
Process terminated with status 1181 (0 minutes, 2 seconds)
1 errors, 0 warnings
So , It seemed like because of the blankspace in the LIBPATH enviroment variable,and C::B split the command line by blankspace.  :(

As you know, reinstall VS2005 is a hardwork, anyone have any fix hint for this bug?
Maybe it is really the right time to install one gcc in my laptop.

And thank all the replier in this topic.
Title: Re: Problem with simple test on Windows
Post by: stahta01 on April 17, 2007, 05:24:35 am
Oh,Thank you, stahta01. Your answer is very useful for me to see the cmd line ,:) .

But I got the following build log:
Code
-------------- Build: Debug in test001 ---------------
......
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\"  /out:bin\Debug\test001.exe  obj\Debug\main.obj   /DEBUG
LINK : fatal error LNK1181: cannot open input file 'Files\Microsoft.obj'
Process terminated with status 1181 (0 minutes, 2 seconds)
1 errors, 0 warnings
So , It seemed like because of the blankspace in the LIBPATH enviroment variable,and C::B split the command line by blankspace.  :(

As you know, reinstall VS2005 is a hardwork, anyone have any fix hint for this bug?
Maybe it is really the right time to install one gcc in my laptop.

And thank all the replier in this topic.


I suggest seeing if the problem is in the batch file %VS80COMNTOOLS%vsvars32.bat
I think that the "\" right before the quote is the problem. I have no idea if this is caused by the vsvars32.bat file but it is possible. I posted the copy of a line(s) that might be the problem line below. Note, I only have express version installed at current time, so my batch may be different than yours. There is another file to check but not sure what it is.

Tim S

Code
@set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB
Title: Re: Problem with simple test on Windows
Post by: RobinMin on April 17, 2007, 07:36:26 am
Thanks again, :)

But, now I have found out one way to resolve this issue. Share it.
As we known , all of this is because of the blank space in the path name. So we define some "custom variable "  , and using it.
This is my step:
1,Setting->Compiler&Debugger setting->[Miscrosoft Visual Studio 2005]->[Custome variables]
2, click [add] button , and add following variable:
  key : VCINSTALLDIR
  value :""C:\Program Files\Microsoft Visual Studio 8\VC""
3, Setting->Compiler&Debugger setting->[Miscrosoft Visual Studio 2005]->[Searching directories]
  add compiler & lnker and resource compiler if you need , the format like this:
   $(VCINSTALLDIR)\include
   $(VCINSTALLDIR)\lib
   ......

It is work fine in my laptop. But it seemed like very slowlly when you open one new project. spend time to parse custome variable??? Anyway, I donot know.

BTW, I can run program now , but I cannot debug source step by step in using cdb.exe. Must I install some old debugger from M$ as  before? I hadn't using C::B few months now.
Title: Re: Problem with simple test on Windows
Post by: stahta01 on April 17, 2007, 05:40:58 pm
I can't help you with debugger questions. I do NOT use them yet. I hope to learn how to in the future, but right now nothing I do is complex enough to require it.

Tim S