Silly "extern" question

This is a discussion on Silly "extern" question within the C Programming forums, part of the General Programming Boards category; So I'm confused about some code I was trying to compile. It's a large project, a dual-network stack, and when ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    2

    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    > Does this mean SOCKET rip_udp_socket is defined somewhere else in the project?
    Yes.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,047
    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.)
    dwk

    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: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    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 Cprogramming.com
    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, 08:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21