Thread: Silly "extern" question

  1. #1
    Registered User
    Join Date
    Jun 2006

    Silly "extern" question

    So I'm confused about some code I was trying to compile. It's a large project, a dual-network stack, and when I added my code to try to build, I got a bunch of unresolved external symbol errors for the variables that I was using, like:

    extern SOCKET rip_udp_socket;

    Does this mean SOCKET rip_udp_socket is defined somewhere else in the project? Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > Does this mean SOCKET rip_udp_socket is defined somewhere else in the project?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    If the errors are compiler errors, you're missing the extern statement. If the errors are linker errors, the variable isn't defined anywhere in the files you're linking with. (So either link with the proper files or put an un-extern declaration in one of the files.)

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Silly question but..
    By swgh in forum C++ Programming
    Replies: 3
    Last Post: 05-05-2008, 12:39 PM
  2. A silly question but it's my doubt ;)
    By chottachatri in forum C++ Programming
    Replies: 19
    Last Post: 04-23-2008, 01:26 PM
  3. Really quick silly question.
    By Jozrael in forum C++ Programming
    Replies: 36
    Last Post: 04-04-2008, 08:31 AM
  4. Question...
    By TechWins in forum A Brief History of
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM