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 » Community » Newbie corner » header file problem
header file problem [message #24676] Wed, 27 January 2010 05:52 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I am having a problem with a header file.
#ifndef _ConnSock_ConnSock_h_
#define _ConnSock_ConnSock_h_

#include <Web/Web.h>

using namespace Upp;

String Request(const String& r)
{
	Socket s;
	if(!ClientSocket(s, CommandLine().GetCount() ? CommandLine()[0] : "127.0.0.1", 5024)) {
		Cout() << "Unable to connect to server!\n";
		SetExitCode(1);
		return Null;
	}
	s.Write(r + '\n');
	String st = s.ReadUntil('\n');
	Cout() << "st " << st << '\n';
	return s.ReadUntil('\n');
}
#endif

This is from a Socket example. It worked fine as an app.
I removed the main and added the top 2 and the last lines.
My main.cpp has #include "ConnSock.h"
This is the errors:

main.obj : error LNK2019: unresolved external symbol "public: class Upp::String __thiscall Upp::Socket::R
eadUntil(char,int,int)" (?<a href="mailto:ReadUntil@Socket" target="_blank">ReadUntil@Socket</a>@Upp@@QAE?<a href="mailto:AVString@2" target="_blank">AVString@2</a<a href="mailto:>@DHH" target="_blank">>@DHH</a>@Z) referenced in function "class U
pp::String __cdecl Request(class Upp::String const &)" (?Request@@YA?AVString@Upp@@ABV12@@Z)
main.obj : error LNK2019: unresolved external symbol "bool __cdecl Upp::ClientSocket(class Upp::Socket &,
char const *,int,bool,unsigned long *,int,bool)" (?ClientSocket@Upp@@YA_<a href="mailto:NAAVSocket@1" target="_blank">NAAVSocket@1</a>@PBDH_NPAKH2@Z) r
eferenced in function "class Upp::String __cdecl Request(class Upp::String const &)" (?Request@@YA?AV
String@Upp@@ABV12@@Z)
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall Upp::Socket::WriteWait(char
const *,int,int)" (?<a href="mailto:WriteWait@Socket" target="_blank">WriteWait@Socket</a>@Upp<a href="mailto:@@QAEHPBDHH" target="_blank">@@QAEHPBDHH</a>@Z) referenced in function "public: void __thiscal
l Upp::Socket::Write(char const *,int)" (?<a href="mailto:Write@Socket" target="_blank">Write@Socket</a>@Upp<a href="mailto:@@QAEXPBDH" target="_blank">@@QAEXPBDH</a>@Z)
C:\upp\out\MSC9.Debug.Debug_full.Gui\Neilson1.exe : fatal error LNK1120: 3 unresolved externals

It has been several years since I worked with C++.
I don't know if this is a basic C++ problem or if it is specific to U++.

edit: I created a directory under c:\upp\Neilson and have Neilson1 and SocketClient. When I pull up SocketClient it works fine. When I pull up Neilson1 that app works fine until #include "ConnSock.h" is added. TheIDE sees the ConnSock.h
Since the externals work with SocketClient.cpp it must be something wrong with my ConnSock.h code.

[Updated on: Wed, 27 January 2010 06:15]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: upp 1875 + Ubuntu 9.10
Next Topic: Using U++ with existing code
Goto Forum:
  


Current Time: Sun Apr 28 18:09:26 CEST 2024

Total time taken to generate the page: 0.05269 seconds