Author Topic: Problem with simple test on Windows  (Read 13195 times)

RobinMin

  • Guest
Problem with simple test on Windows
« 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


Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Problem with simple test on Windows
« Reply #1 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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problem with simple test on Windows
« Reply #2 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
« Last Edit: April 16, 2007, 08:08:28 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Alturin

  • Guest
Re: Problem with simple test on Windows
« Reply #3 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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problem with simple test on Windows
« Reply #4 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

RobinMin

  • Guest
Re: Problem with simple test on Windows
« Reply #5 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problem with simple test on Windows
« Reply #6 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
« Last Edit: April 17, 2007, 05:27:57 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

RobinMin

  • Guest
Re: Problem with simple test on Windows
« Reply #7 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problem with simple test on Windows
« Reply #8 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org