Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » cpp/icpp name clashes [BUG?]
Re: cpp/icpp name clashes [BUG] [message #25839 is a reply to message #25805] Mon, 15 March 2010 03:57 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Question:
How GCC, MSC, OW, CLANG compilers will assemble following source code consisted of FileName, FileName.cpp, FileName.h, FileName.icpp, main.cpp files?
Answer:
GCC input:
gcc -x c++ FileName FileName.cpp FileName.icpp main.cpp

GCC output files:
a.exe

MSC input:
cl /nologo /TP FileName FileName.cpp FileName.icpp main.cpp

MSC output:
FileName
FileName.cpp
FileName.icpp
main.cpp
Generating Code...
FileName.obj : warning LNK4042: object specified more than once; extras ignored
FileName.obj : warning LNK4042: object specified more than once; extras ignored
main.obj : error LNK2019: unresolved external symbol "int __cdecl ICppFunction(void)" (?ICppFunction@@YAHXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "int __cdecl CppFunction(void)" (?CppFunction@@YAHXZ) referenced in function _main
FileName.exe : fatal error LNK1120: 2 unresolved externals

OW input:
wcl386 -zq -cc++ FileName FileName.cpp FileName.icpp main.cpp

Some OW output:
Error! E2028: int near Function() is an undefined reference
Error! E2028: int near ICppFunction() is an undefined reference
file MAIN.obj(C:\MAIN.CPP): undefined symbol int near Function()
file MAIN.obj(C:\MAIN.CPP): undefined symbol int near ICppFunction()
Error: Linker returned a bad status

CLANG input:
clang -x c++ FileName FileName.cpp FileName.icpp main.cpp

CLANG output files:
a.out

Conclusion:
Some compilers can resolve extension clashes internally, but others only with output renaming.

Notes:
For testing used following tools:
gcc (TDM-2 mingw32) 4.4.1
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Open Watcom C/C++32 Compile and Link Utility Version 1.9beta1 LA
clang version 1.1 (trunk 98527)

Source code:
File FileName:
#include "FileName.h"

int Function()
{
	return 0;
}

File FileName.cpp:
#include "FileName.h"

int CppFunction()
{
	return 1;
}

File FileName.h:
#ifndef __FileName_h__
#define __FileName_h__

int Function();
int CppFunction();
int ICppFunction();

#endif

File FileName.icpp:
#include "FileName.h"

int ICppFunction()
{
	return 2;
}

File main.cpp:
#include "FileName.h"

int main()
{
	int result = Function() + CppFunction() + ICppFunction();

	return result; // 3
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: theIDE crashes on win32 since revision 2221
Next Topic: batch build
Goto Forum:
  


Current Time: Fri May 10 17:24:00 CEST 2024

Total time taken to generate the page: 0.01966 seconds