- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A full compatibility with Microsoft and GCC C++ compilers for a macro __FILE__ is not supported. I'd like to bring attention of Intel C++ compiler team even if it is a small issue. Here are examples: [ Intel C++ compiler ] Source File Name: .\../../Test/BaseSetTest.cpp [ Microsoft C++ compiler ] Source File Name: c:\workenv\test\basesettest.cpp [ MinGW C++ compiler ( GCC for Windows ) ] Source File Name: ../../Test/BaseSetTest.cpp
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry but I need more information to reproduce the problem. Please provide the command line options used.
This is what I see:
!% cat ../test.cpp
#include "stdio.h"
int main()
{
printf( "Source File Name: %s\n", __FILE__ );
return 0;
}
!% cl D:/TRACKER/FORUM/test.cpp && ./test
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Source File Name: D:/TRACKER/FORUM/test.cpp
!% icl D:/TRACKER/FORUM/test.cpp && ./test
Intel(R) C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Jan 28 2013 19:53:03 by jward4 on JWARD4-DESK in D:/workspaces/cfe/dev
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
test.obj
Source File Name: D:/TRACKER/FORUM/test.cpp
!% cl ../test.cpp && ./test
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Source File Name: ../test.cpp
!% icl ../test.cpp && ./test
Intel(R) C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Jan 28 2013 19:53:03 by jward4 on JWARD4-DESK in D:/workspaces/cfe/dev
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
test.obj
Source File Name: ../test.cpp
!%
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes please create a Makefile or show me the icl and cl command line options used. I don't have acess to a Visual Studio environment.
thanks,
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't see any incompatibilty with Microsoft using those command line options, i.e. the Source file name printed is the same.
!% cat Test.cpp
#include "stdio.h"
void main( void )
{
#ifdef _DEBUG
printf( "Source File Name: %s\n", __FILE__ );
#else
printf( "Source File Name: %s\n", "null" );
#endif
}
!% icl -D_DEBUG Test.cpp && ./Test.exe
Intel(R) C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Feb 5 2013 13:30:17 by jward4 on JWARD4-DESK in D:/workspaces/cfe/dev
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Test.cpp
Test.cpp(4): warning #1079: return type of function "main" must be "int"
void main( void )
^
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
-out:Test.exe
Test.obj
Source File Name: Test.cpp
!% cl -D_DEBUG Test.cpp && ./Test.exe
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
Test.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
/out:Test.exe
Test.obj
Source File Name: Test.cpp
!%
The __FILE__ macro should print out the source file as specified on the command line so if you are seeing a difference between cl and icl it's probably because the command line is different. So I think this is either because you changed something in the project or the IDE converted the project incorrectly. I don't think it's a bug in the compiler itself.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When we use the command line to create the executable, the response from icc and gcc binary are the same. When I used VS2008 IDE and created the binary using cl and icl, cl binary version was emitting absolute path of the .cpp while the icl binary version was emitting relative path to the .cpp file with reference to the location of VS project (Project working directory). Here are the outputs which I see:
cl binary output:
Source File Name: c:\temp\blah1\blah1\blah1.cpp
Press any key to continue . . .
icl binary output:
Source File Name: .\blah1.cpp
Press any key to continue . . .
Though one gives absolute path and other one gives the relative path, it does give the right path to the file. I am not sure if this is a compatibilty issue. I am attaching the sample VS2008 solution for reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page