GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-May-2005, 18:52
nomad311 nomad311 is offline
New Member
 
Join Date: May 2005
Posts: 5
nomad311 is on a distinguished road

cant compile with g++ on a unix server


i have successfully compiled this exe with bloodshed's dev and visual on my windows pc, but when i attempt to do so i get an error in collect2. also with visual i get 81 warnings!!! but it still compiles and runs flawlessly here are some of those:
Quote:
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std: :char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,st d::allocator<char>
>,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information

Quote:
c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector<std::basic_string<char,std::char_trai ts<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_ traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits< char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_ traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information

Quote:
c:\documents and settings\ta\desktop\p5\drugs.cpp(148) : warning C4786: '__unwindfunclet$?printTypes@Drugs@@QAE?AV?$vector @V?$basic_string@DU?$char_traits@D@std@@V?$allocat or@D@2@@std@@V?$allocator@V?$basic_string@DU?$char _traits@D@std@@V?$allocator
@D@2@@std@@@2@@std@@ABV?$basic_string@DU?$char_tra its@D@std@@V?$allocator@D@2@@3@@Z$9' : identifier was truncated to '255' characters in the debug information

----------------------------------------------------------------

then with g++ i get this one:
Quote:
g++ -Wall -O -g -c main.cpp
g++ -Wall -O -g main.o
Undefined first referenced
symbol in file
Drugs::getDrug(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) constmain.o
Drug::print() main.o
Drug::removeName(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drug::addName(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drugs::printTypes(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drugs::clear() main.o
Drugs::print() main.o
Drugs::removeDrug(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drugs::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drugs::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
Drugs::~Drugs [in-charge]() main.o
Drugs::Drugs[in-charge]() main.o
Drugs::addDrug(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)main.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `a.out'
---------------------------------------------------------------

personally i think its got something to do with my vector<string>'s but thats commin from a cosc 2 student ha

thanx for your help ppl
-nomad311
  #2  
Old 01-May-2005, 19:42
Stack Overflow's Avatar
Stack Overflow Stack Overflow is offline
Junior Member
 
Join Date: Apr 2005
Location: Arizona
Posts: 35
Stack Overflow will become famous soon enough
Hello,

The C4786 warning is caused by symbols with decorated names that exceed 255 characters, respectively. The best solution is to shorten the length of the identifier or compile for Release mode. If the identifier is a function call, reducing the number of parameters will help reduce the length. With Visual C++ versions 2.x and later, using /Z7 generates the C4786 warning as listed above. This warning can be ignored although the identifier may not be accessible or viewable in the debugger.

From a sample code off the Microsoft support site:

CPP / C++ / C Code:
/* Compile options needed: /Zi
*/

#include <conio.h>
// The next three lines should be on one continous line
 class CAboutClassaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
{
public:
// The next three lines should be on one continous line
       CAboutClassaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb() {}

// The next three lines should be on one continous line
      ~CAboutClassaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(){}
 };
void main(void)
{
// The next three lines should be on one continous line
 CAboutClassaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb test1;
       getch();
}

It means that MSVC++ 6.0 only uses a maximum of 255 characters for storing identifier names for debugging, so when debugging, the identifier will appear as the appropriate name, yet it chops off everything after the 255th character. You can usually safely just ignore or even disable this warning.


Quote:
g++ -Wall -O -g main.o
Undefined first referenced
symbol in file

This basically means that main cannot find Drugs::getDrug(), Drug::print(), and the following shown in that list. One resolution to that problem is to include the header file that contains your class definition and body. If you already have a header file, be sure to #include that header in main.cpp.

Also, one thing I did notice was that you build main.cpp and attempt to build main.o:
Quote:
g++ -Wall -O -g -c main.cpp
g++ -Wall -O -g main.o
That, I believe, is the wrong way of doing it. Here is another way of doing it:
Quote:
g++ -o main.o -Wall -O -g -c main.cpp
That builds main.cpp with the appropriate flags and it's output file will be main.o. When you want to build it as a program, you can do the following:
Quote:
g++ -o myprog main.o
As myprog will be the name of your program. If you have additional *.o files, you can add them to the build list.

If you have further questions, please feel free to ask.


- Stack Overflow
__________________
Following the rules will ensure you get a prompt answer to your question. If posting code, please include BB [C] / [C++] tags. Your question may have been asked before, try the search facility.
  #3  
Old 01-May-2005, 20:54
nomad311 nomad311 is offline
New Member
 
Join Date: May 2005
Posts: 5
nomad311 is on a distinguished road
ha Stack i was reading in another forum proly while u were writing all that and i just compiled it manually (not using the make file) ...so i realized (after 7hrs of trash!!!!) that i had to add all the .cpp's to the SRCS line. then everything worked out -so here the Makefile is is (incase any1 else was as slow as myself):
Quote:
CC = g++
CFLAGS = -Wall -O -g
SRCS = main.cpp amphetamine.cpp barbituate.cpp cannabis.cpp hallucinogen.cpp opiate.cpp tranquillizer.cpp drug.cpp drugs.cpp
OBJS = ${SRCS:.cpp=.o}

a.out: $(OBJS)
$(CC) $(CFLAGS) $(OBJS)

$(OBJS):
$(CC) $(CFLAGS) -c $*.cpp

depend:
$(CC) -MM $(SRCS) > Makefile.dep

clean:
rm -f $(OBJS) a.out core

include Makefile.dep
and the Makefile.dep (made by %make depend):
Quote:
main.o: main.cpp main.h drug.h opiate.h hallucinogen.h barbituate.h \
amphetamine.h tranquillizer.h cannabis.h drugs.h
amphetamine.o: amphetamine.cpp amphetamine.h drug.h
barbituate.o: barbituate.cpp barbituate.h drug.h
cannabis.o: cannabis.cpp cannabis.h drug.h
hallucinogen.o: hallucinogen.cpp hallucinogen.h drug.h
opiate.o: opiate.cpp opiate.h drug.h
tranquillizer.o: tranquillizer.cpp tranquillizer.h drug.h
-----------------------------------------------------------------

heres what im workin with:
vector.h -(template class) depends on uhhh ...stl's ha
drug.h/.cpp -depends on vector
amphetamine.h/.cpp barbituate.h/.cpp hallucinogen.h/.cpp opiate.h/.cpp tranquillizer.h/.cpp -depends on drug
drugs.h/.cpp -depends on the types of drugs
main.h/.cpp -depends on everything else

so thnx again SO
-nomad311
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I include a directory on a networked drive on the Apache2 server? thewheelman Apache Web Server Forum 0 23-Mar-2005 12:38
.o compile UNIX stuff ... help please! crq C++ Forum 5 28-Jan-2005 08:43
Running Your Own Web Server Rajaat Web Hosting Forum 9 05-Jan-2005 22:54
how to post MYSQL data to web server bearky Web Hosting Forum 6 13-Jul-2004 06:08
· Windows 2003 Server Reseller Special: Unlimited Domains/2 GB Space/for $19.99 contactsonia Web Hosting Advertisements & Offers 0 09-Jan-2004 06:46

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:50.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.