Opened 11 years ago

Last modified 8 years ago

#41020 assigned defect

gcc48: undefined symbol for toupper(int) when compiled as C11

Reported by: davydden@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: qpjevi@…, etienne.renault@…, macports@…
Port: gcc48

Description

The simple example which uses toupper(int)

#include <stdio.h>
#include <ctype.h>
int main ()
{
  int i=0;
  char str[]="Test String.\n";
  char c;
  while (str[i])
  {
    c=str[i];
    putchar (toupper(c));
    i++;
  }
  return 0;
 }

does link via

g++-mp-4.8 main.cc -o main

but does not when invoking C11:

g++-mp-4.8 -std=c++11 main.cc -o main

Undefined symbols for architecture x86_64:
  "toupper(int)", referenced from:
      _main in ccWjHauc.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Macports was build on Xcode 5 under 10.9. I am not sure if this is related to gcc4.8, but this behavior was not the case for the previous Xcode (4.6) and OS-X Mountain Lion.

Change History (6)

comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to mww@…
Port: gcc48 added; gcc removed
Summary: undefined symbol for toupper(int) when compiled as C11gcc48: undefined symbol for toupper(int) when compiled as C11

comment:2 Changed 11 years ago by qpjevi@…

Cc: qpjevi@… added

Cc Me!

comment:3 in reply to:  2 Changed 11 years ago by etienne.renault@…

Replying to qpjevi@…:

Cc Me!

This bug has been reported at https://trac.macports.org/ticket/41033 and the solution mentioned worked for me !

comment:4 Changed 11 years ago by etienne.renault@…

Cc: etienne.renault@… added

Cc Me!

comment:5 Changed 11 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:6 Changed 8 years ago by kurthindenburg (Kurt Hindenburg)

Owner: changed from mww@… to macports-tickets@…
Status: newassigned
Note: See TracTickets for help on using tickets.