bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug: gnu linker resolves two symbols but of different type


From: Norman Goldstein
Subject: bug: gnu linker resolves two symbols but of different type
Date: Wed, 5 Feb 2020 00:05:24 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Runnig on fedora 30, x86-64.
Here are two source files which compile and link without error, but which break type expectations and not what the programmer would want.  The type of "foo" is different in the two files:

a.cpp:
//////
double foo = 2.1;

b.cpp
//////
#include <iostream>
using namespace std;

extern int foo;

int main( int argc, char* argv[] )
{
  cout << "foo= " << foo << endl;

  return 0;
}

////////////
On Windows 10, the visual studio cl.exe complains at link time.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]