I'm just doing an exercice on lists of object. I'm a beginner still...
I have 3 files:
-main.cpp //main fonction is in there
-list.cpp
-list.h
Quit sure my code is correct.But when I compile it and run it with g++ (version 6.3.0) in VSCode, I get this error message:
AppData\Local\Temp\cckbchz9.o:main.cpp:(.text$_ZN5ListeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE7insererEiRKS5_[__ZN5ListeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE7insererEiRKS5_]+0x4d):
**undefined reference to `Liste**<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::CreerNoeud(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
**collect2.exe**: erreur : ld a retourné 1 code d'état d'exécution
So I tried to compile my 3 files to object files with command prompt and then linking/executing the files:
g++ -c liste.cpp liste.h main.cpp
g++ -o liste.o main.o -L libstdc++-6
( I updated this because i thought it would resolve the problem)
But I still get the error message.
When i use libstdc++(g++ -o main.o liste.o -L libstdc++) , I get:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: erreur : ld a retourné 1 code d'état d'exécution
My main fonction is declared : int main(void){//CODE}
So I've been looking on internet for 2H. Please help me ...
This small code reproduce the error(but you need to install raylib)
#include<iostream>
#include "C:/raylib/raylib/src/raylib.h"
using namespace std;
void InitWindow(int width, int height, const char *title);
int main(void){
InitWindow(10,10,"fenetre");
return 0;
}